本文整理汇总了C++中_stricmp函数的典型用法代码示例。如果您正苦于以下问题:C++ _stricmp函数的具体用法?C++ _stricmp怎么用?C++ _stricmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_stricmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GCMenuHook
int __cdecl GCMenuHook(WPARAM wParam,LPARAM lParam) {
GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam;
DBVARIANT dbv;
TCHAR* szInvite = TranslateT("&Invite user...");
TCHAR* szLeave = TranslateT("&Leave chat session");
TCHAR* szTopic = TranslateT("Set &Topic...");
TCHAR* szDetails = TranslateT("User &details");
TCHAR* szHistory = TranslateT("User &history");
TCHAR* szKick = TranslateT("&Kick user");
static struct gc_item Item_log[] = {
{NULL, 10, MENU_ITEM, FALSE},
{NULL, 30, MENU_ITEM, FALSE},
{NULL, 20, MENU_ITEM, FALSE}
};
static struct gc_item Item_nicklist_me[] = {
{NULL, 20, MENU_ITEM, FALSE},
{_T(""), 100, MENU_SEPARATOR, FALSE},
{NULL, 110, MENU_ITEM, FALSE}
};
static struct gc_item Item_nicklist[] = {
{NULL, 10, MENU_ITEM, FALSE},
{NULL, 20, MENU_ITEM, FALSE},
{NULL, 30, MENU_ITEM, FALSE}
};
UNREFERENCED_PARAMETER(wParam);
Item_log[0].pszDesc = szInvite;
Item_log[1].pszDesc = szTopic;
Item_log[2].pszDesc = szLeave;
Item_nicklist_me[0].pszDesc = szHistory;
Item_nicklist_me[2].pszDesc = szLeave;
Item_nicklist[0].pszDesc = szDetails;
Item_nicklist[1].pszDesc = szHistory;
Item_nicklist[2].pszDesc = szKick;
LOG (("GCMenuHook started."));
if(gcmi) {
if (!_stricmp(gcmi->pszModule, SKYPE_PROTONAME)) {
switch (gcmi->Type)
{
case MENU_ON_LOG:
gcmi->nItems = sizeof(Item_log)/sizeof(Item_log[0]);
gcmi->Item = &Item_log[0];
LOG (("GCMenuHook: Items in log window: %d", gcmi->nItems));
break;
case MENU_ON_NICKLIST:
if (db_get_ts(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1;
if (!lstrcmp(dbv.ptszVal, gcmi->pszUID)) {
gcmi->nItems = sizeof(Item_nicklist_me)/sizeof(Item_nicklist_me[0]);
gcmi->Item = &Item_nicklist_me[0];
} else {
gchat_contacts *gcs = GetChat(gcmi->pszID);
gchat_contact *gc = gcs?GetChatContact(gcs, gcmi->pszUID):NULL;
gcmi->nItems = sizeof(Item_nicklist)/sizeof(Item_nicklist[0]);
Item_nicklist[2].bDisabled = FALSE;
if (gc && !gc->hContact)
{
gcmi->nItems -= 2;
gcmi->Item = &Item_nicklist[2];
}
else
gcmi->Item = &Item_nicklist[0];
/*
if (protocol<7) Item_nicklist[2].bDisabled = TRUE;
else {
TCHAR *szChatRole;
if (szChatRole = SkypeGetT ("CHAT", gcmi->pszID, "MYROLE")) {
if (_tcscmp(szChatRole, _T("MASTER")) && _tcscmp(szChatRole, _T("CREATOR")))
Item_nicklist[2].bDisabled = TRUE;
free (szChatRole);
}
}*/
}
db_free(&dbv);
break;
}
} else {LOG (("GCMenuHook: ERROR: Not our protocol."));}
} else {LOG (("GCMenuHook: ERROR: No gcmi"));}
LOG (("GCMenuHook: terminated."));
return 0;
}
示例2: freerdp_client_rdp_file_set_integer
BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name, int value, int index)
{
BOOL bStandard = TRUE;
#ifdef DEBUG_CLIENT_FILE
fprintf(stderr, "%s:i:%d\n", name, value);
#endif
if (_stricmp(name, "use multimon") == 0)
file->UseMultiMon = value;
else if (_stricmp(name, "screen mode id") == 0)
file->ScreenModeId = value;
else if (_stricmp(name, "span monitors") == 0)
file->SpanMonitors = value;
else if (_stricmp(name, "smart sizing") == 0)
file->SmartSizing = value;
else if (_stricmp(name, "enablesuperpan") == 0)
file->EnableSuperSpan = value;
else if (_stricmp(name, "superpanaccelerationfactor") == 0)
file->SuperSpanAccelerationFactor = value;
else if (_stricmp(name, "desktopwidth") == 0)
file->DesktopWidth = value;
else if (_stricmp(name, "desktopheight") == 0)
file->DesktopHeight = value;
else if (_stricmp(name, "desktop size id") == 0)
file->DesktopSizeId = value;
else if (_stricmp(name, "session bpp") == 0)
file->SessionBpp = value;
else if (_stricmp(name, "compression") == 0)
file->Compression = value;
else if (_stricmp(name, "keyboardhook") == 0)
file->KeyboardHook = value;
else if (_stricmp(name, "disable ctrl+alt+del") == 0)
file->DisableCtrlAltDel = value;
else if (_stricmp(name, "audiomode") == 0)
file->AudioMode = value;
else if (_stricmp(name, "audioqualitymode") == 0)
file->AudioQualityMode = value;
else if (_stricmp(name, "audiocapturemode") == 0)
file->AudioCaptureMode = value;
else if (_stricmp(name, "videoplaybackmode") == 0)
file->VideoPlaybackMode = value;
else if (_stricmp(name, "connection type") == 0)
file->ConnectionType = value;
else if (_stricmp(name, "networkautodetect") == 0)
file->NetworkAutoDetect = value;
else if (_stricmp(name, "bandwidthautodetect") == 0)
file->BandwidthAutoDetect = value;
else if (_stricmp(name, "pinconnectionbar") == 0)
file->PinConnectionBar = value;
else if (_stricmp(name, "displayconnectionbar") == 0)
file->DisplayConnectionBar = value;
else if (_stricmp(name, "workspaceid") == 0)
file->WorkspaceId = value;
else if (_stricmp(name, "enableworkspacereconnect") == 0)
file->EnableWorkspaceReconnect = value;
else if (_stricmp(name, "disable wallpaper") == 0)
file->DisableWallpaper = value;
else if (_stricmp(name, "allow font smoothing") == 0)
file->AllowFontSmoothing = value;
else if (_stricmp(name, "allow desktop composition") == 0)
file->AllowDesktopComposition = value;
else if (_stricmp(name, "disable full window drag") == 0)
file->DisableFullWindowDrag = value;
else if (_stricmp(name, "disable menu anims") == 0)
file->DisableMenuAnims = value;
else if (_stricmp(name, "disable themes") == 0)
file->DisableThemes = value;
else if (_stricmp(name, "disable cursor setting") == 0)
file->DisableCursorSetting = value;
else if (_stricmp(name, "bitmapcachesize") == 0)
file->BitmapCacheSize = value;
else if (_stricmp(name, "bitmapcachepersistenable") == 0)
file->BitmapCachePersistEnable = value;
else if (_stricmp(name, "server port") == 0)
file->ServerPort = value;
else if (_stricmp(name, "redirectdrives") == 0)
file->RedirectDrives = value;
else if (_stricmp(name, "redirectprinters") == 0)
file->RedirectPrinters = value;
else if (_stricmp(name, "redirectcomports") == 0)
file->RedirectComPorts = value;
else if (_stricmp(name, "redirectsmartcards") == 0)
file->RedirectSmartCards = value;
else if (_stricmp(name, "redirectclipboard") == 0)
file->RedirectClipboard = value;
else if (_stricmp(name, "redirectposdevices") == 0)
file->RedirectPosDevices = value;
else if (_stricmp(name, "redirectdirectx") == 0)
file->RedirectDirectX = value;
else if (_stricmp(name, "disableprinterredirection") == 0)
file->DisablePrinterRedirection = value;
else if (_stricmp(name, "disableclipboardredirection") == 0)
file->DisableClipboardRedirection = value;
else if (_stricmp(name, "connect to console") == 0)
file->ConnectToConsole = value;
else if (_stricmp(name, "administrative session") == 0)
file->AdministrativeSession = value;
else if (_stricmp(name, "autoreconnection enabled") == 0)
file->AutoReconnectionEnabled = value;
//.........这里部分代码省略.........
示例3: rpl_stat
//.........这里部分代码省略.........
buf->st_dev = 0;
# if _GL_WINDOWS_STAT_INODES == 2
buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0;
# else /* _GL_WINDOWS_STAT_INODES == 1 */
buf->st_ino = 0;
# endif
# else
/* st_ino is not wide enough for identifying a file on a device.
Without st_ino, st_dev is pointless. */
buf->st_dev = 0;
buf->st_ino = 0;
# endif
/* st_mode. */
unsigned int mode =
/* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */
((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG)
| S_IREAD_UGO
| ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO);
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
/* Determine whether the file is executable by looking at the file
name suffix. */
if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0)
{
const char *last_dot = NULL;
const char *p;
for (p = info.cFileName; *p != '\0'; p++)
if (*p == '.')
last_dot = p;
if (last_dot != NULL)
{
const char *suffix = last_dot + 1;
if (_stricmp (suffix, "exe") == 0
|| _stricmp (suffix, "bat") == 0
|| _stricmp (suffix, "cmd") == 0
|| _stricmp (suffix, "com") == 0)
mode |= S_IEXEC_UGO;
}
}
}
buf->st_mode = mode;
/* st_nlink. Ignore hard links here. */
buf->st_nlink = 1;
/* There's no easy way to map the Windows SID concept to an integer. */
buf->st_uid = 0;
buf->st_gid = 0;
/* st_rdev is irrelevant for normal files and directories. */
buf->st_rdev = 0;
/* st_size. */
if (sizeof (buf->st_size) <= 4)
/* Range check already done above. */
buf->st_size = info.nFileSizeLow;
else
buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow;
/* st_atime, st_mtime, st_ctime. */
# if _GL_WINDOWS_STAT_TIMESPEC
buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime);
buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime);
buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime);
# else
示例4: if
//this will take a list of properties and convert it to internal values
bool CBaseFXProps::ParseProperties(FX_PROP* pProps, uint32 nNumProps)
{
//counts of how many of each key
uint32 nNumColorKeys = 0;
uint32 nNumScaleKeys = 0;
//go through the property list and parse in all the known variables and
//count up how many of each key type we have
uint32 nCurrProp = 0;
for(nCurrProp = 0; nCurrProp < nNumProps; nCurrProp++)
{
FX_PROP& fxProp = pProps[nCurrProp];
if( !_stricmp( fxProp.m_sName, FXPROP_UPDATEPOS ))
{
m_nFollowType = (uint32)fxProp.GetComboVal();
}
else if( !_stricmp( fxProp.m_sName, FXPROP_ATTACHNAME ))
{
fxProp.GetStringVal( m_szAttach );
}
else if( !_stricmp( fxProp.m_sName, FXPROP_OFFSET ))
{
m_vOffset = fxProp.GetVector();
}
else if( !_stricmp( fxProp.m_sName, FXPROP_ROTATEADD ))
{
m_vRotAdd = fxProp.GetVector();
}
else if( !_stricmp( fxProp.m_sName, FXPROP_MENULAYER ))
{
m_nMenuLayer = fxProp.GetIntegerVal();
}
else if( !_stricmp( fxProp.m_sName, "Ck" ))
{
nNumColorKeys++;
}
else if( !_stricmp( fxProp.m_sName, "Sk" ))
{
nNumScaleKeys++;
}
}
//allocate our arrays of key types
debug_deletea( m_pColorKeys );
m_pColorKeys = debug_newa( FX_COLOURKEY, nNumColorKeys );
m_nNumColorKeys = 0;
debug_deletea( m_pScaleKeys );
m_pScaleKeys = debug_newa( FX_SCALEKEY, nNumScaleKeys );
m_nNumScaleKeys = 0;
//now actually read in each key type
for(nCurrProp = 0; nCurrProp < nNumProps; nCurrProp++)
{
FX_PROP& fxProp = pProps[nCurrProp];
if( !_stricmp( fxProp.m_sName, "Ck" ))
{
// Add this key to the list of keys
FX_COLOURKEY fxClrKey;
fxClrKey.m_tmKey = fxProp.m_data.m_clrKey.m_tmKey;
fxClrKey.m_red = (float) (fxProp.m_data.m_clrKey.m_dwCol & 0x000000FF);
fxClrKey.m_green = (float)((fxProp.m_data.m_clrKey.m_dwCol & 0x0000FF00) >> 8);
fxClrKey.m_blue = (float)((fxProp.m_data.m_clrKey.m_dwCol & 0x00FF0000) >> 16);
fxClrKey.m_alpha = (float)((fxProp.m_data.m_clrKey.m_dwCol & 0xFF000000) >> 24);
if(m_pColorKeys)
m_pColorKeys[m_nNumColorKeys++] = fxClrKey;
}
else if( !_stricmp( fxProp.m_sName, "Sk" ))
示例5: main
// The main programme
int main( int argc, char *argv[] )
{
printf( "%s\n", XBNBT_VER.c_str( ) );
#ifdef WIN32
if( argv[0] )
{
char *szEndPos = strrchr( argv[0], CHAR_BS );
if( szEndPos )
{
char *szEXEPath = new char[szEndPos - argv[0] + 1];
memcpy( szEXEPath, argv[0], szEndPos - argv[0] );
szEXEPath[szEndPos - argv[0]] = TERM_CHAR;
SetCurrentDirectory( szEXEPath );
delete [] szEXEPath;
}
}
if( argc > 1 )
{
// The Trinity Edition 7.5r3 - Addition Begins
// Added for Custom NT Service Name Code
CFG_Open( CFG_FILE );
#define BNBT_SERVICE_NAME const_cast<LPSTR> (CFG_GetString( "cbtt_service_name", "BNBT Service" ).c_str())
CFG_Close( CFG_FILE );
printf( "Service name %s\n", string( BNBT_SERVICE_NAME ).c_str( ) );
// install service
if( _stricmp( argv[1], "-i" ) == 0 )
{
if( UTIL_NTServiceTest( ) )
printf( "BNBT Service is already installed!\n" );
else
{
if( UTIL_NTServiceInstall( ) )
printf( "BNBT Service installed.\n" );
else
printf( "BNBT Service failed to install (error %d).\n", GetLastError( ) );
}
return 0;
}
// uninstall service
else if( _stricmp( argv[1], "-u" ) == 0 )
{
if( !UTIL_NTServiceTest( ) )
printf( "BNBT Service is not installed!\n" );
else
{
if( UTIL_NTServiceUninstall( ) )
printf( "BNBT Service uninstalled.\n" );
else
printf( "BNBT Service failed to uninstall (error %d).\n", GetLastError( ) );
}
return 0;
}
// start
else if( _stricmp( argv[1], "-start" ) == 0 )
{
if( !UTIL_NTServiceTest( ) )
printf( "BNBT Service is not installed!\n" );
else
{
printf( "Starting BNBT Service.\n" );
if( !UTIL_NTServiceStart( ) )
printf( "BNBT Service failed to start (error %d).\n", GetLastError( ) );
}
return 0;
}
// stop
else if( _stricmp( argv[1], "-stop" ) == 0 )
{
if( !UTIL_NTServiceTest( ) )
printf( "BNBT Service is not installed!\n" );
else
{
printf( "Stopping BNBT Service.\n" );
if( !UTIL_NTServiceStop( ) )
printf( "BNBT Service failed to stop (error %d).\n", GetLastError( ) );
}
return 0;
}
// internal start
else if( _stricmp( argv[1], "-s" ) == 0 )
{
SERVICE_TABLE_ENTRY st[] = { { BNBT_SERVICE_NAME, NTServiceMain }, { 0, 0 } };
StartServiceCtrlDispatcher( st );
return 0;
//.........这里部分代码省略.........
示例6: v_repMessage
// This is the plugin messaging routine (i.e. V-REP calls this function very often, with various messages):
VREP_DLLEXPORT void* v_repMessage(int message,int* auxiliaryData,void* customData,int* replyData)
{ // This is called quite often. Just watch out for messages/events you want to handle
// Keep following 6 lines at the beginning and unchanged:
simLockInterface(1);
static bool refreshDlgFlag=true;
int errorModeSaved;
simGetIntegerParameter(sim_intparam_error_report_mode,&errorModeSaved);
simSetIntegerParameter(sim_intparam_error_report_mode,sim_api_errormessage_ignore);
void* retVal=NULL;
// Here we can intercept many messages from V-REP (actually callbacks). Only the most important messages are listed here.
// For a complete list of messages that you can intercept/react with, search for "sim_message_eventcallback"-type constants
// in the V-REP user manual.
if (message==sim_message_eventcallback_refreshdialogs)
refreshDlgFlag=true; // V-REP dialogs were refreshed. Maybe a good idea to refresh this plugin's dialog too
if (message==sim_message_eventcallback_menuitemselected)
{ // A custom menu bar entry was selected..
// here you could make a plugin's main dialog visible/invisible
}
if (message==sim_message_eventcallback_instancepass)
{ // This message is sent each time the scene was rendered (well, shortly after) (very often)
// It is important to always correctly react to events in V-REP. This message is the most convenient way to do so:
int flags=auxiliaryData[0];
bool sceneContentChanged=((flags&(1+2+4+8+16+32+64+256))!=0); // object erased, created, model or scene loaded, und/redo called, instance switched, or object scaled since last sim_message_eventcallback_instancepass message
bool instanceSwitched=((flags&64)!=0);
if (instanceSwitched)
{
// React to an instance switch here!!
}
if (sceneContentChanged)
{ // we actualize plugin objects for changes in the scene
//...
refreshDlgFlag=true; // always a good idea to trigger a refresh of this plugin's dialog here
}
}
if (message==sim_message_eventcallback_mainscriptabouttobecalled)
{ // The main script is about to be run (only called while a simulation is running (and not paused!))
}
if (message==sim_message_eventcallback_simulationabouttostart)
{ // Simulation is about to start
}
if (message==sim_message_eventcallback_simulationended)
{ // Simulation just ended
}
if (message==sim_message_eventcallback_moduleopen)
{ // A script called simOpenModule (by default the main script). Is only called during simulation.
if ( (customData==NULL)||(_stricmp("PluginSkeleton",(char*)customData)==0) ) // is the command also meant for this plugin?
{
// we arrive here only at the beginning of a simulation
}
}
if (message==sim_message_eventcallback_modulehandle)
{ // A script called simHandleModule (by default the main script). Is only called during simulation.
if ( (customData==NULL)||(_stricmp("PluginSkeleton",(char*)customData)==0) ) // is the command also meant for this plugin?
{
// we arrive here only while a simulation is running
}
}
if (message==sim_message_eventcallback_moduleclose)
{ // A script called simCloseModule (by default the main script). Is only called during simulation.
if ( (customData==NULL)||(_stricmp("PluginSkeleton",(char*)customData)==0) ) // is the command also meant for this plugin?
{
// we arrive here only at the end of a simulation
}
}
if (message==sim_message_eventcallback_instanceswitch)
{ // Here the user switched the scene. React to this message in a similar way as you would react to a full
// scene content change. In this plugin example, we react to an instance switch by reacting to the
// sim_message_eventcallback_instancepass message and checking the bit 6 (64) of the auxiliaryData[0]
// (see here above)
}
if (message==sim_message_eventcallback_broadcast)
{ // Here we have a plugin that is broadcasting data (the broadcaster will also receive this data!)
}
if (message==sim_message_eventcallback_scenesave)
{ // The scene is about to be saved. If required do some processing here (e.g. add custom scene data to be serialized with the scene)
//.........这里部分代码省略.........
示例7: MSVCRT_locale_to_LCID
/* Internal: Find the LCID for a locale specification */
static LCID MSVCRT_locale_to_LCID(locale_search_t* locale)
{
LCID lcid;
EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), (LPSTR)RT_STRING,
(LPCSTR)LOCALE_ILANGUAGE,find_best_locale_proc,
(LONG_PTR)locale);
if (!locale->match_flags)
return 0;
/* If we were given something that didn't match, fail */
if (locale->search_country[0] && !(locale->match_flags & FOUND_COUNTRY))
return 0;
lcid = MAKELCID(locale->found_lang_id, SORT_DEFAULT);
/* Populate partial locale, translating LCID to locale string elements */
if (!locale->found_codepage[0])
{
/* Even if a codepage is not enumerated for a locale
* it can be set if valid */
if (locale->search_codepage[0])
{
if (IsValidCodePage(atoi(locale->search_codepage)))
memcpy(locale->found_codepage,locale->search_codepage,MAX_ELEM_LEN);
else
{
/* Special codepage values: OEM & ANSI */
if (_stricmp(locale->search_codepage,"OCP"))
{
GetLocaleInfoA(lcid, LOCALE_IDEFAULTCODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
}
if (_stricmp(locale->search_codepage,"ACP"))
{
GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
}
else
return 0;
if (!atoi(locale->found_codepage))
return 0;
}
}
else
{
/* Prefer ANSI codepages if present */
GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
if (!locale->found_codepage[0] || !atoi(locale->found_codepage))
GetLocaleInfoA(lcid, LOCALE_IDEFAULTCODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
}
}
GetLocaleInfoA(lcid, LOCALE_SENGLANGUAGE|LOCALE_NOUSEROVERRIDE,
locale->found_language, MAX_ELEM_LEN);
GetLocaleInfoA(lcid, LOCALE_SENGCOUNTRY|LOCALE_NOUSEROVERRIDE,
locale->found_country, MAX_ELEM_LEN);
return lcid;
}
示例8: debugPrintf
KUSB_HANDLE USBDevice::FindDevice()
{
KLST_HANDLE DeviceList = NULL;
KUSB_HANDLE handle = NULL;
KLST_DEVINFO_HANDLE DeviceInfo = NULL;
KLST_DEVINFO_HANDLE tmpDeviceInfo = NULL;
ULONG deviceCount = 0;
m_errorCode = ERROR_SUCCESS;
// Get the device list
if (!LstK_Init(&DeviceList, KLST_FLAG_NONE))
{
#ifdef _DEBUG
debugPrintf("ASIOUAC: Error initializing device list.\n");
#endif
return NULL;
}
LstK_Count(DeviceList, &deviceCount);
if (!deviceCount)
{
#ifdef _DEBUG
debugPrintf("ASIOUAC: No devices in device list.\n");
#endif
SetLastError(ERROR_DEVICE_NOT_CONNECTED);
// If LstK_Init returns TRUE, the list must be freed.
LstK_Free(DeviceList);
return NULL;
}
#ifdef _DEBUG
debugPrintf("ASIOUAC: Looking for device with DeviceInterfaceGUID %s\n", _T(_DeviceInterfaceGUID));
#endif
LstK_MoveReset(DeviceList);
//
//
// Call LstK_MoveNext after a LstK_MoveReset to advance to the first
// element.
while(LstK_MoveNext(DeviceList, &tmpDeviceInfo)
&& DeviceInfo == NULL)
{
if(!_stricmp(tmpDeviceInfo->DeviceInterfaceGUID, _DeviceInterfaceGUID) && tmpDeviceInfo->Connected)
{
DeviceInfo = tmpDeviceInfo;
break;
}
}
if (!DeviceInfo)
{
#ifdef _DEBUG
debugPrintf("ASIOUAC: Device not found.\n");
#endif
// If LstK_Init returns TRUE, the list must be freed.
LstK_Free(DeviceList);
return NULL;
}
// Initialize the device with the "dynamic" Open function
if (!UsbK_Init(&handle, DeviceInfo))
{
handle = NULL;
m_errorCode = GetLastError();
#ifdef _DEBUG
debugPrintf("ASIOUAC: UsbK_Init failed. ErrorCode: %08Xh\n", m_errorCode);
#endif
}
LstK_Free(DeviceList);
return handle;
}
示例9: strcasecmp
int __cdecl strcasecmp(_In_z_ const char * s1, _In_z_ const char * s2)
{
return _stricmp(s1, s2);
}
示例10: wmain
int wmain(int argc, wchar_t **wcargv)
{
char** argv;
#else
int
main(int argc, char** argv)
{
#endif
int eargv_size;
int eargc_base; /* How many arguments in the base of eargv. */
char* emulator;
char* basename;
char* def_emu_lookup_path;
char scriptname[PMAX];
char** last_opt;
char** first_opt;
#ifdef __WIN32__
int i;
int len;
/* Convert argv to utf8 */
argv = emalloc((argc+1) * sizeof(char*));
for (i=0; i<argc; i++) {
len = WideCharToMultiByte(CP_UTF8, 0, wcargv[i], -1, NULL, 0, NULL, NULL);
argv[i] = emalloc(len*sizeof(char));
WideCharToMultiByte(CP_UTF8, 0, wcargv[i], -1, argv[i], len, NULL, NULL);
}
argv[argc] = NULL;
#endif
/*
* Allocate the argv vector to be used for arguments to Erlang.
* Arrange for starting to pushing information in the middle of
* the array, to allow easy addition of commands in the beginning.
*/
eargv_size = argc*4+1000+LINEBUFSZ/2;
eargv_base = (char **) emalloc(eargv_size*sizeof(char*));
eargv = eargv_base;
eargc = 0;
eargc_base = eargc;
eargv = eargv + eargv_size/2;
eargc = 0;
/* Determine basename of the executable */
for (basename = argv[0]+strlen(argv[0]);
basename > argv[0] && !(IS_DIRSEP(basename[-1]));
--basename)
;
first_opt = argv;
last_opt = argv;
#ifdef __WIN32__
if ( (_stricmp(basename, "escript.exe") == 0)
||(_stricmp(basename, "escript") == 0)) {
#else
if (strcmp(basename, "escript") == 0) {
#endif
def_emu_lookup_path = argv[0];
/*
* Locate all options before the script name.
*/
while (argc > 1 && argv[1][0] == '-') {
argc--;
argv++;
last_opt = argv;
}
if (argc <= 1) {
error("Missing filename\n");
}
strncpy(scriptname, argv[1], sizeof(scriptname));
scriptname[sizeof(scriptname)-1] = '\0';
argc--;
argv++;
} else {
char *absname = find_prog(argv[0]);
#ifdef __WIN32__
int len = strlen(absname);
if (len >= 4 && _stricmp(absname+len-4, ".exe") == 0) {
absname[len-4] = '\0';
}
#endif
erts_snprintf(scriptname, sizeof(scriptname), "%s.escript",
absname);
efree(absname);
def_emu_lookup_path = scriptname;
}
/* Determine path to emulator */
emulator = get_env("ESCRIPT_EMULATOR");
if (emulator == NULL) {
emulator = get_default_emulator(def_emu_lookup_path);
}
if (strlen(emulator) >= PMAX)
error("Value of environment variable ESCRIPT_EMULATOR is too large");
//.........这里部分代码省略.........
示例11: GetExplorerLogonPid
DWORD GetExplorerLogonPid()
{
DWORD dwSessionId;
DWORD dwExplorerLogonPid=0;
PROCESSENTRY32 procEntry;
// HANDLE hProcess,hPToken;
pWTSGetActiveConsoleSessionId WTSGetActiveConsoleSessionIdF=NULL;
WTSProcessIdToSessionIdF=NULL;
HMODULE hlibkernel = LoadLibrary("kernel32.dll");
if (hlibkernel)
{
WTSGetActiveConsoleSessionIdF=(pWTSGetActiveConsoleSessionId)GetProcAddress(hlibkernel, "WTSGetActiveConsoleSessionId");
WTSProcessIdToSessionIdF=(pProcessIdToSessionId)GetProcAddress(hlibkernel, "ProcessIdToSessionId");
}
if (WTSGetActiveConsoleSessionIdF!=NULL)
dwSessionId =WTSGetActiveConsoleSessionIdF();
else dwSessionId=0;
if( GetSystemMetrics( SM_REMOTESESSION))
if (WTSProcessIdToSessionIdF!=NULL)
{
DWORD dw = GetCurrentProcessId();
DWORD pSessionId = 0xFFFFFFFF;
WTSProcessIdToSessionIdF( dw, &pSessionId );
dwSessionId=pSessionId;
}
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap == INVALID_HANDLE_VALUE)
{
if (hlibkernel) FreeLibrary(hlibkernel);
return 0 ;
}
procEntry.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(hSnap, &procEntry))
{
CloseHandle(hSnap);
if (hlibkernel) FreeLibrary(hlibkernel);
return 0 ;
}
do
{
if (_stricmp(procEntry.szExeFile, "explorer.exe") == 0)
{
DWORD dwExplorerSessId = 0;
if (WTSProcessIdToSessionIdF!=NULL)
{
if (WTSProcessIdToSessionIdF(procEntry.th32ProcessID, &dwExplorerSessId)
&& dwExplorerSessId == dwSessionId)
{
dwExplorerLogonPid = procEntry.th32ProcessID;
break;
}
}
else dwExplorerLogonPid = procEntry.th32ProcessID;
}
} while (Process32Next(hSnap, &procEntry));
CloseHandle(hSnap);
if (hlibkernel) FreeLibrary(hlibkernel);
return dwExplorerLogonPid;
}
示例12: _stricmp
int Platform::Stricmp(const char *str1, const char *str2)
{
return _stricmp(str1, str2);
}
示例13: if
/**************************************************************************************************
This function handles events.
**************************************************************************************************/
void CGroup::HandleEvent(UINT uEvent)
{
if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_NONE) == 0)
{
return;
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_RENAME) == 0)
{
ListView_EditLabel(m_hwndListView, ListView_GetNextItem(m_hwndListView, -1, LVNI_FOCUSED));
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_EXECUTE) == 0)
{
if (ListView_GetSelectedCount(m_hwndListView) == 1)
{
int iItem = ListView_GetNextItem(m_hwndListView, -1, LVNI_SELECTED);
char szFileName[MAX_PATH];
if (GetNameFromId(iItem, szFileName, sizeof(szFileName)))
{
if (utils::Is_Directory(szFileName))
{
if (m_bInlineBrowsing)
{
return ChangeDir(".selected");
}
else if (m_bExplicitCalls)
{
LSExecuteEx(NULL, "open", "explorer.exe", szFileName, NULL, SW_SHOWNORMAL);
return;
}
}
}
}
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_RETURN, NULL);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_DELETE) == 0)
{
DeleteFiles();
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_PASTE) == 0)
{
DoPaste();
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_UNDO) == 0)
{
// TODO::Add support for this
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_COPY) == 0)
{
CopyFiles(false);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_CUT) == 0)
{
CopyFiles(true);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_SELECTALL) == 0)
{
ListView_SetItemState(m_hwndListView, -1, LVIS_SELECTED, LVIS_SELECTED);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_REFRESH) == 0)
{
SaveState();
m_pView2->Refresh();
RestoreState();
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_UP) == 0)
{
ChangeDir(".up");
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_CHANGEDIR) == 0)
{
ChangeDir(".selected");
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_DOWNKEY) == 0)
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_DOWN, NULL);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_UPKEY) == 0)
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_UP, NULL);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_LEFTKEY) == 0)
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_LEFT, NULL);
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_RIGHTKEY) == 0)
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_RIGHT, NULL);
}
else
{
LSExecute(m_hwndListView, m_szEventCommand[uEvent], SW_SHOWNORMAL);
}
}
示例14: CallWindowProc
/**************************************************************************************************
This function handles mouse events.
**************************************************************************************************/
void CGroup::HandleMouseEvent(UINT uEvent, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (m_bExplorerDesktop)
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, msg, wParam, lParam);
return;
}
if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_LBUTTONDBLCLK)
{
LVHITTESTINFO lvhi = {0};
lvhi.flags = LVHT_ONITEM;
lvhi.pt.x = GET_X_LPARAM(lParam);
lvhi.pt.y = GET_Y_LPARAM(lParam);
if ( ListView_HitTest(m_hwndListView, &lvhi) != -1 )
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, msg, wParam, lParam);
if (msg == WM_LBUTTONDOWN && m_bSingleClick)
SendMessage(m_hwndListView, WM_LBUTTONDBLCLK, wParam, lParam);
return; // An icon was clicked.
}
}
if (m_bStealFocus)
SetFocus(m_hwndListView);
if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_CHANGEDIR) == 0)
{
// We can override HandleEvent actions like this ;)
LVHITTESTINFO lvhi = {0};
lvhi.flags = LVHT_ONITEM;
lvhi.pt.x = GET_X_LPARAM(lParam);
lvhi.pt.y = GET_Y_LPARAM(lParam);
if (msg == WM_MOUSEWHEEL || msg == WM_MOUSEHWHEEL)
{
MapWindowPoints(HWND_DESKTOP, m_hwndListView, &lvhi.pt, 1);
}
int nFileid = ListView_HitTest(m_hwndListView, &lvhi);
if ( nFileid != -1 )
{
char szFileName[MAX_PATH];
if (GetNameFromId(nFileid, szFileName, sizeof(szFileName)))
{
if (utils::Is_Directory(szFileName))
{
if (!m_bNoVirtualSwitch && (_stricmp(szFileName, m_szDesktopPath) == 0))
{
ChangeDir(".desktop");
}
else
{
ChangeDir(szFileName);
}
return;
}
}
}
}
// We just need to handle the mouse specific events and then forward the event to HandleEvent
if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_RECTANGLE) == 0)
{
if (CheckModkeys(m_wSelectionRectangleMod))
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_LBUTTONDOWN, wParam, lParam);
}
else
{
relayMouseMessage(msg, wParam, lParam);
}
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_SYSTEMMENU) == 0)
{
if (CheckModkeys(m_wSystemMenuMod))
{
CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_RBUTTONDOWN, wParam, lParam);
}
else
{
relayMouseMessage(msg, wParam, lParam);
}
}
else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_FORWARD) == 0)
{
relayMouseMessage(msg, wParam, lParam);
}
else
{
HandleEvent(uEvent);
}
}
示例15: PrepareAddrInfoHints2
RNS2BindResult RNS2_Berkley::BindSharedIPV4And6( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line ) {
(void) file;
(void) line;
(void) bindParameters;
#if RAKNET_SUPPORT_IPV6==1
int ret=0;
struct addrinfo hints;
struct addrinfo *servinfo=0, *aip; // will point to the results
PrepareAddrInfoHints2(&hints);
hints.ai_family=bindParameters->addressFamily;
char portStr[32];
Itoa(bindParameters->port,portStr,10);
// On Ubuntu, "" returns "No address associated with hostname" while 0 works.
if (bindParameters->hostAddress &&
(_stricmp(bindParameters->hostAddress,"UNASSIGNED_SYSTEM_ADDRESS")==0 || bindParameters->hostAddress[0]==0))
{
getaddrinfo(0, portStr, &hints, &servinfo);
}
else
{
getaddrinfo(bindParameters->hostAddress, portStr, &hints, &servinfo);
}
// Try all returned addresses until one works
for (aip = servinfo; aip != NULL; aip = aip->ai_next)
{
// Open socket. The address type depends on what
// getaddrinfo() gave us.
rns2Socket = socket__(aip->ai_family, aip->ai_socktype, aip->ai_protocol);
if (rns2Socket == -1)
return BR_FAILED_TO_BIND_SOCKET;
ret = bind__(rns2Socket, aip->ai_addr, (int) aip->ai_addrlen );
if (ret>=0)
{
// Is this valid?
memcpy(&boundAddress.address.addr6, aip->ai_addr, sizeof(boundAddress.address.addr6));
freeaddrinfo(servinfo); // free the linked-list
SetSocketOptions();
SetNonBlockingSocket(bindParameters->nonBlockingSocket);
SetBroadcastSocket(bindParameters->setBroadcast);
GetSystemAddressIPV4And6( rns2Socket, &boundAddress );
return BR_SUCCESS;
}
else
{
closesocket__(rns2Socket);
}
}
return BR_FAILED_TO_BIND_SOCKET;
#else
return BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE;
#endif
}