您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetSystemDirectoryW函数代码示例

51自学网 2021-06-01 21:15:46
  C++
这篇教程C++ GetSystemDirectoryW函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetSystemDirectoryW函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSystemDirectoryW函数的具体用法?C++ GetSystemDirectoryW怎么用?C++ GetSystemDirectoryW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetSystemDirectoryW函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SQLInstallDriverExW

BOOL WINAPI SQLInstallDriverExW(LPCWSTR lpszDriver, LPCWSTR lpszPathIn,               LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut,               WORD fRequest, LPDWORD lpdwUsageCount){    UINT len;    LPCWSTR p;    WCHAR path[MAX_PATH];    clear_errors();    TRACE("%s %s %p %d %p %d %p/n", debugstr_w(lpszDriver),          debugstr_w(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,          fRequest, lpdwUsageCount);    for (p = lpszDriver; *p; p += lstrlenW(p) + 1)        TRACE("%s/n", debugstr_w(p));    len = GetSystemDirectoryW(path, MAX_PATH);    if (pcbPathOut)        *pcbPathOut = len;    len = GetSystemDirectoryW(path, MAX_PATH);    if (lpszPathOut && cbPathOutMax > len)    {        lstrcpyW(lpszPathOut, path);        return TRUE;    }    return FALSE;}
开发者ID:YongHaoWu,项目名称:wine-hub,代码行数:30,


示例2: GetDirectories

static void GetDirectories(){	WinScopedPreserveLastError s;	// system directory	{		const UINT length = GetSystemDirectoryW(0, 0);		ENSURE(length != 0);		std::wstring path(length, '/0');		const UINT charsWritten = GetSystemDirectoryW(&path[0], length);		ENSURE(charsWritten == length-1);		systemPath = new(wutil_Allocate(sizeof(OsPath))) OsPath(path);	}	// executable's directory	executablePath = new(wutil_Allocate(sizeof(OsPath))) OsPath(sys_ExecutablePathname().Parent());	// roaming application data	roamingAppdataPath = GetFolderPath(CSIDL_APPDATA);	// local application data	localAppdataPath = GetFolderPath(CSIDL_LOCAL_APPDATA);	// my documents	personalPath = GetFolderPath(CSIDL_PERSONAL);}
开发者ID:Gallaecio,项目名称:0ad,代码行数:26,


示例3: test_GetSystemDirectoryW

static void test_GetSystemDirectoryW(void){    UINT len, len_with_null;    WCHAR buf[MAX_PATH];    static const WCHAR fooW[] = {'f','o','o',0};    len_with_null = GetSystemDirectoryW(NULL, 0);    if (len_with_null == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)    {        win_skip("GetSystemDirectoryW is not available/n");        return;    }    ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH/n");    lstrcpyW(buf, fooW);    len = GetSystemDirectoryW(buf, 1);    ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer/n");    ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d/n",       len, len_with_null);    lstrcpyW(buf, fooW);    len = GetSystemDirectoryW(buf, len_with_null - 1);    ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer/n");    ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d/n",       len, len_with_null);    lstrcpyW(buf, fooW);    len = GetSystemDirectoryW(buf, len_with_null);    ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer/n");    ok(len == lstrlenW(buf), "returned length should be equal to the length of string/n");    ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d/n",       len, len_with_null-1);}
开发者ID:AmesianX,项目名称:wine,代码行数:33,


示例4: ReleaseOnVistaOrXP

int ReleaseOnVistaOrXP(const union client_cfg& cfg, bool isXP){	char szTempPath[MAX_PATH], szTempFilePath[MAX_PATH];	if(0 == GetTempPathA(MAX_PATH, szTempPath))		return -1;	if(0 == GetTempFileNameA(szTempPath, "dll", 0, szTempFilePath))		return false;	if(ReleaseFile(szTempFilePath, cfg, SVRCTRL_DLL) < 0)		return -1;		if(isXP)	{		char dllName[MAX_PATH] = {0};		_snprintf(dllName, MAX_PATH, "%s//%s", szTempPath, "msvcctrl.dll");		DeleteFileA(dllName);		MoveFileA(szTempFilePath, dllName);		LoadLibraryA(dllName);		return 0;	}	HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);	if(hSnapshot == INVALID_HANDLE_VALUE)		return -1;	tagPROCESSENTRY32 pe;	ZeroMemory(&pe, sizeof(pe));	pe.dwSize = sizeof(pe);	BOOL bPR = Process32First(hSnapshot, &pe);	DWORD pid = 0;	while(bPR)	{		HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);		if (hProc != 0)	CloseHandle(hProc);		if(strcmp(pe.szExeFile, "explorer.exe") == 0)		{			pid = pe.th32ProcessID;			break;		}		bPR = Process32Next(hSnapshot, &pe);	}	wchar_t filename[MAX_PATH] = {0};	int len = MultiByteToWideChar(CP_ACP, 0, szTempFilePath, strlen(szTempFilePath), NULL, 0);	if(len < 0 || len > MAX_PATH)	return -1;	MultiByteToWideChar(CP_ACP, 0, szTempFilePath, strlen(szTempFilePath), filename, len);	wchar_t szCmd[MAX_PATH] = {0}, szDir[MAX_PATH] = {0}, szPathToSelf[MAX_PATH] = {0};	wchar_t strOurDllPath[MAX_PATH] = {0};	GetSystemDirectoryW(szDir, sizeof(szDir));	GetSystemDirectoryW(szCmd, sizeof(szCmd));	wcscat(szCmd, L"//cmd.exe");	GetModuleFileNameW(NULL, szPathToSelf, MAX_PATH);	AttemptOperation( true, true, pid, L"explorer,exe", szCmd, L"", szDir, filename);	return 0;}
开发者ID:diduoren,项目名称:youeryuan,代码行数:59,


示例5: service_start_process

static DWORD service_start_process(struct service_entry *service_entry, HANDLE *process){    PROCESS_INFORMATION pi;    STARTUPINFOW si;    LPWSTR path = NULL;    DWORD size;    BOOL r;    service_lock_exclusive(service_entry);    if (service_entry->config.dwServiceType == SERVICE_KERNEL_DRIVER)    {        static const WCHAR winedeviceW[] = {'//','w','i','n','e','d','e','v','i','c','e','.','e','x','e',' ',0};        DWORD len = GetSystemDirectoryW( NULL, 0 ) + sizeof(winedeviceW)/sizeof(WCHAR) + strlenW(service_entry->name);        if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))            return ERROR_NOT_ENOUGH_SERVER_MEMORY;        GetSystemDirectoryW( path, len );        lstrcatW( path, winedeviceW );        lstrcatW( path, service_entry->name );    }    else    {        size = ExpandEnvironmentStringsW(service_entry->config.lpBinaryPathName,NULL,0);        path = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));        if (!path)            return ERROR_NOT_ENOUGH_SERVER_MEMORY;        ExpandEnvironmentStringsW(service_entry->config.lpBinaryPathName,path,size);    }    ZeroMemory(&si, sizeof(STARTUPINFOW));    si.cb = sizeof(STARTUPINFOW);    if (!(service_entry->config.dwServiceType & SERVICE_INTERACTIVE_PROCESS))    {        static WCHAR desktopW[] = {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n','//','D','e','f','a','u','l','t',0};        si.lpDesktop = desktopW;    }    service_entry->status.dwCurrentState = SERVICE_START_PENDING;    service_unlock(service_entry);    r = CreateProcessW(NULL, path, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);    HeapFree(GetProcessHeap(),0,path);    if (!r)    {        service_lock_exclusive(service_entry);        service_entry->status.dwCurrentState = SERVICE_STOPPED;        service_unlock(service_entry);        return GetLastError();    }    service_entry->status.dwProcessId = pi.dwProcessId;    *process = pi.hProcess;    CloseHandle( pi.hThread );    return ERROR_SUCCESS;}
开发者ID:bilboed,项目名称:wine,代码行数:58,


示例6: WINHELP_EntryPoint

/************************************************************************** *           WINHELP entry point * * FIXME: should go into winhlp32.exe, but we don't support 16-bit modules in executables yet. */void WINAPI WINHELP_EntryPoint( CONTEXT86 *context ){    static const WCHAR winhlp32W[] = {'//','w','i','n','h','l','p','3','2','.','e','x','e',0};    PDB16 *psp;    INT len, total;    WCHAR *cmdline, *p;    PROCESS_INFORMATION info;    STARTUPINFOW startup;    DWORD count, exit_code = 1;    InitTask16( context );    TRACE( "(ds=%x es=%x fs=%x gs=%x, bx=%04x cx=%04x di=%04x si=%x)/n",            context->SegDs, context->SegEs, context->SegFs, context->SegGs,            context->Ebx, context->Ecx, context->Edi, context->Esi );    psp = GlobalLock16( context->SegEs );    len = MultiByteToWideChar( CP_ACP, 0, (char *)psp->cmdLine + 1, psp->cmdLine[0], NULL, 0 );    total = (GetSystemDirectoryW( NULL, 0 ) + len + 1) * sizeof(WCHAR) + sizeof(winhlp32W);    cmdline = HeapAlloc( GetProcessHeap(), 0, total );    GetSystemDirectoryW( cmdline, total );    lstrcatW( cmdline, winhlp32W );    p = cmdline + lstrlenW(cmdline);    if (len)    {        *p++ = ' ';        MultiByteToWideChar( CP_ACP, 0, (char *)psp->cmdLine + 1, psp->cmdLine[0], p, len );        p[len] = 0;    }    memset( &startup, 0, sizeof(startup) );    startup.cb = sizeof(startup);    if (CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info ))    {        /* Give 10 seconds to the app to come up */        if (wait_input_idle( info.hProcess, 10000 ) == WAIT_FAILED)            WARN("WaitForInputIdle failed: Error %d/n", GetLastError() );        ReleaseThunkLock( &count );        WaitForSingleObject( info.hProcess, INFINITE );        GetExitCodeProcess( info.hProcess, &exit_code );        CloseHandle( info.hThread );        CloseHandle( info.hProcess );    }    else        ReleaseThunkLock( &count );    HeapFree( GetProcessHeap(), 0, cmdline );    ExitThread( exit_code );}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:56,


示例7: wWinMain

int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow){    static const WCHAR wscriptW[] = {'//','w','s','c','r','i','p','t','.','e','x','e',0};    static const WCHAR parbW[] = {' ','/','B',' ',0};    WCHAR app[MAX_PATH];    WCHAR cmd[MAX_PATH];    PROCESS_INFORMATION pi;    BOOL ret;    DWORD exitcode;    STARTUPINFOW si = { sizeof(si) };    WINE_FIXME("(%p %p %s %x) forwarding to wscript/n", hInst, hPrevInst, wine_dbgstr_w(cmdline), cmdshow);    GetSystemDirectoryW(app, MAX_PATH);    strcatW(app, wscriptW);    strcpyW(cmd, app);    strcatW(app, parbW);    strcatW(app, cmdline);    if (!CreateProcessW(app, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return 1;    WaitForSingleObject( pi.hProcess, INFINITE );    ret = GetExitCodeProcess(pi.hProcess, &exitcode);    CloseHandle( pi.hProcess );    CloseHandle( pi.hThread );    if (ret)        return exitcode;    else        return 1;}
开发者ID:klickverbot,项目名称:wine,代码行数:31,


示例8: SQLInstallDriverManagerW

BOOL WINAPI SQLInstallDriverManagerW(LPWSTR lpszPath, WORD cbPathMax,               WORD *pcbPathOut){    UINT len;    WCHAR path[MAX_PATH];    TRACE("(%p %d %p)/n", lpszPath, cbPathMax, pcbPathOut);    if (cbPathMax < MAX_PATH)        return FALSE;    clear_errors();    len = GetSystemDirectoryW(path, MAX_PATH);    if (pcbPathOut)        *pcbPathOut = len;    if (lpszPath && cbPathMax > len)    {    	lstrcpyW(lpszPath, path);    	return TRUE;    }    return FALSE;}
开发者ID:YongHaoWu,项目名称:wine-hub,代码行数:25,


示例9: rtldrNativeLoadSystem

int rtldrNativeLoadSystem(const char *pszFilename, const char *pszExt, uint32_t fFlags, PRTLDRMOD phLdrMod){    /*     * We only try the System32 directory.     */    WCHAR wszSysDir[MAX_PATH];    UINT cwcSysDir = GetSystemDirectoryW(wszSysDir, MAX_PATH);    if (cwcSysDir >= MAX_PATH)        return VERR_FILENAME_TOO_LONG;    char szPath[RTPATH_MAX];    char *pszPath = szPath;    int rc = RTUtf16ToUtf8Ex(wszSysDir, RTSTR_MAX, &pszPath, sizeof(szPath), NULL);    if (RT_SUCCESS(rc))    {        rc = RTPathAppend(szPath, sizeof(szPath), pszFilename);        if (pszExt && RT_SUCCESS(rc))            rc = RTStrCat(szPath, sizeof(szPath), pszExt);        if (RT_SUCCESS(rc))        {            if (RTFileExists(szPath))                rc = RTLdrLoadEx(szPath, phLdrMod, fFlags, NULL);            else                rc = VERR_MODULE_NOT_FOUND;        }    }    return rc;}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:29,


示例10: SHGetStockIconInfo

/**************************************************************************** * SHGetStockIconInfo [[email
C++ GetSystemInfo函数代码示例
C++ GetSystemDirectory函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。