• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetWindowsDirectoryW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: search_for_inf

static HINF search_for_inf(LPCVOID InfSpec, DWORD SearchControl)
{
    HINF hInf = INVALID_HANDLE_VALUE;
    WCHAR inf_path[MAX_PATH];

    static const WCHAR infW[] = {'\\','i','n','f','\\',0};
    static const WCHAR system32W[] = {'\\','s','y','s','t','e','m','3','2','\\',0};

    if (SearchControl == INFINFO_REVERSE_DEFAULT_SEARCH)
    {
        GetWindowsDirectoryW(inf_path, MAX_PATH);
        lstrcatW(inf_path, system32W);
        lstrcatW(inf_path, InfSpec);

        hInf = SetupOpenInfFileW(inf_path, NULL,
                                 INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
        if (hInf != INVALID_HANDLE_VALUE)
            return hInf;

        GetWindowsDirectoryW(inf_path, MAX_PATH);
        lstrcpyW(inf_path, infW);
        lstrcatW(inf_path, InfSpec);

        return SetupOpenInfFileW(inf_path, NULL,
                                 INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
    }

    return INVALID_HANDLE_VALUE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:29,代码来源:query.c


示例2: test_GetWindowsDirectoryW

static void test_GetWindowsDirectoryW(void)
{
    UINT len, len_with_null;
    WCHAR buf[MAX_PATH];
    static const WCHAR fooW[] = {'f','o','o',0};

    len_with_null = GetWindowsDirectoryW(NULL, 0);
    if (len_with_null == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
    {
        win_skip("GetWindowsDirectoryW is not implemented\n");
        return;
    }
    ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");

    lstrcpyW(buf, fooW);
    len = GetWindowsDirectoryW(buf, 1);
    ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
    ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
       len, len_with_null);

    lstrcpyW(buf, fooW);
    len = GetWindowsDirectoryW(buf, len_with_null - 1);
    ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
    ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
       len, len_with_null);

    lstrcpyW(buf, fooW);
    len = GetWindowsDirectoryW(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, "GetWindowsDirectoryW returned %d, expected %d\n",
       len, len_with_null-1);
}
开发者ID:AmesianX,项目名称:wine,代码行数:33,代码来源:directory.c


示例3: GetWindowsDirectoryW

char *win32_get_font_dir(const char *font_file)
{
    wchar_t wdir[MAX_PATH];
    if (S_OK != SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir)) {
        int lenght = GetWindowsDirectoryW(wdir, MAX_PATH);
        if (lenght == 0 || lenght > (MAX_PATH - 8)) {
            BD_DEBUG(DBG_FILE, "Font directory path too long!\n");
            return NULL;
        }
        if (!wcscat(wdir, L"\\fonts")) {
            BD_DEBUG(DBG_FILE, "Could not construct font directory path!\n");
            return NULL;
        }

    }

    int   len  = WideCharToMultiByte (CP_UTF8, 0, wdir, -1, NULL, 0, NULL, NULL);
    char *path = malloc(len + strlen(font_file) + 2);
    if (path) {
        WideCharToMultiByte(CP_UTF8, 0, wdir, -1, path, len, NULL, NULL);
        path[len - 1] = '\\';
        strcpy(path + len, font_file);
    }
    return path;
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:25,代码来源:dirs_win32.c


示例4: bCheckIfDualBootingWithWin31

BOOL bCheckIfDualBootingWithWin31()
{
    WCHAR Buffer[32];
    WCHAR awcWindowsDir[MAX_PATH];
    DWORD dwRet;
    UINT  cwchWinPath = GetWindowsDirectoryW(awcWindowsDir, MAX_PATH);

// the cwchWinPath value does not include the terminating zero

    if (awcWindowsDir[cwchWinPath - 1] == L'\\')
    {
        cwchWinPath -= 1;
    }
    awcWindowsDir[cwchWinPath] = L'\0'; // make sure to zero terminated

    lstrcatW(awcWindowsDir, L"\\system32\\");
    lstrcatW(awcWindowsDir, WINNT_GUI_FILE_W);

    dwRet = GetPrivateProfileStringW(
                WINNT_DATA_W,
                WINNT_D_WIN31UPGRADE_W,
                WINNT_A_NO_W,
                Buffer,
                sizeof(Buffer)/sizeof(WCHAR),
                awcWindowsDir
                );

    #if DBG
    DbgPrint("\n dwRet = %ld, win31upgrade = %ws\n\n", dwRet, Buffer);
    #endif

    return (BOOL)(dwRet ? (!lstrcmpiW(Buffer,WINNT_A_YES)) : 0);
}
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:33,代码来源:fntsweep.c


示例5: SetupUninstallOEMInfW

/***********************************************************************
 *      SetupUninstallOEMInfW  ([email protected])
 */
BOOL WINAPI SetupUninstallOEMInfW( PCWSTR inf_file, DWORD flags, PVOID reserved )
{
    static const WCHAR infW[] = {'\\','i','n','f','\\',0};
    WCHAR target[MAX_PATH];

    TRACE("%s, 0x%08x, %p\n", debugstr_w(inf_file), flags, reserved);

    if (!inf_file)
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    if (!GetWindowsDirectoryW( target, sizeof(target)/sizeof(WCHAR) )) return FALSE;

    strcatW( target, infW );
    strcatW( target, inf_file );

    if (flags & SUOI_FORCEDELETE)
        return DeleteFileW(target);

    FIXME("not deleting %s\n", debugstr_w(target));

    return TRUE;
}
开发者ID:CSRedRat,项目名称:RosWine,代码行数:28,代码来源:misc.c


示例6: InstallInfSection

/* Install a section of a .inf file
 * Returns TRUE if success, FALSE if failure. Error code can
 * be retrieved with GetLastError()
 */
static
BOOL
InstallInfSection(
    IN HWND hWnd,
    IN LPCWSTR InfFile,
    IN LPCWSTR InfSection OPTIONAL,
    IN LPCWSTR InfService OPTIONAL)
{
    WCHAR Buffer[MAX_PATH];
    HINF hInf = INVALID_HANDLE_VALUE;
    UINT BufferSize;
    PVOID Context = NULL;
    BOOL ret = FALSE;

    /* Get Windows directory */
    BufferSize = MAX_PATH - 5 - wcslen(InfFile);
    if (GetWindowsDirectoryW(Buffer, BufferSize) > BufferSize)
    {
        /* Function failed */
        SetLastError(ERROR_GEN_FAILURE);
        goto cleanup;
    }
    /* We have enough space to add some information in the buffer */
    if (Buffer[wcslen(Buffer) - 1] != '\\')
        wcscat(Buffer, L"\\");
    wcscat(Buffer, L"Inf\\");
    wcscat(Buffer, InfFile);

    /* Install specified section */
    hInf = SetupOpenInfFileW(Buffer, NULL, INF_STYLE_WIN4, NULL);
    if (hInf == INVALID_HANDLE_VALUE)
        goto cleanup;

    Context = SetupInitDefaultQueueCallback(hWnd);
    if (Context == NULL)
        goto cleanup;

    ret = TRUE;
    if (ret && InfSection)
    {
        ret = SetupInstallFromInfSectionW(
            hWnd, hInf,
            InfSection, SPINST_ALL,
            NULL, NULL, SP_COPY_NEWER,
            SetupDefaultQueueCallbackW, Context,
            NULL, NULL);
    }
    if (ret && InfService)
    {
        ret = SetupInstallServicesFromInfSectionW(
            hInf, InfService, 0);
    }

cleanup:
    if (Context)
        SetupTermDefaultQueueCallback(Context);
    if (hInf != INVALID_HANDLE_VALUE)
        SetupCloseInfFile(hInf);
    return ret;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:64,代码来源:install.c


示例7: MSTASK_ITaskScheduler_AddWorkItem

static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(ITaskScheduler *iface, LPCWSTR name, IScheduledWorkItem *item)
{
    static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 };
    static const WCHAR jobW[] = { '.','j','o','b',0 };
    WCHAR task_name[MAX_PATH];
    IPersistFile *pfile;
    HRESULT hr;

    TRACE("%p, %s, %p\n", iface, debugstr_w(name), item);

    if (strchrW(name, '.')) return E_INVALIDARG;

    GetWindowsDirectoryW(task_name, MAX_PATH);
    lstrcatW(task_name, tasksW);
    lstrcatW(task_name, name);
    lstrcatW(task_name, jobW);

    hr = IScheduledWorkItem_QueryInterface(item, &IID_IPersistFile, (void **)&pfile);
    if (hr == S_OK)
    {
        hr = IPersistFile_Save(pfile, task_name, TRUE);
        IPersistFile_Release(pfile);
    }
    return hr;
}
开发者ID:wine-mirror,项目名称:wine,代码行数:25,代码来源:task_scheduler.c


示例8: TranslateConsoleName

static VOID
TranslateConsoleName(OUT LPWSTR DestString,
                     IN LPCWSTR ConsoleName,
                     IN UINT MaxStrLen)
{
#define PATH_SEPARATOR L'\\'

    UINT wLength;

    if ( DestString   == NULL  || ConsoleName  == NULL ||
         *ConsoleName == L'\0' || MaxStrLen    == 0 )
    {
        return;
    }

    wLength = GetWindowsDirectoryW(DestString, MaxStrLen);
    if ((wLength > 0) && (_wcsnicmp(ConsoleName, DestString, wLength) == 0))
    {
        wcsncpy(DestString, L"%SystemRoot%", MaxStrLen);
        // FIXME: Fix possible buffer overflows there !!!!!
        wcsncat(DestString, ConsoleName + wLength, MaxStrLen);
    }
    else
    {
        wcsncpy(DestString, ConsoleName, MaxStrLen);
    }

    /* Replace path separators (backslashes) by underscores */
    while ((DestString = wcschr(DestString, PATH_SEPARATOR))) *DestString = L'_';
}
开发者ID:Strongc,项目名称:reactos,代码行数:30,代码来源:settings.c


示例9: get_assembly_directory

static BOOL get_assembly_directory(LPWSTR dir, DWORD size, BYTE architecture)
{
    static const WCHAR gac[] = {'\\','a','s','s','e','m','b','l','y','\\','G','A','C',0};

    static const WCHAR msil[] = {'_','M','S','I','L',0};
    static const WCHAR x86[] = {'_','3','2',0};
    static const WCHAR amd64[] = {'_','6','4',0};

    GetWindowsDirectoryW(dir, size);
    strcatW(dir, gac);

    switch (architecture)
    {
        case peMSIL:
            strcatW(dir, msil);
            break;

        case peI386:
            strcatW(dir, x86);
            break;

        case peAMD64:
            strcatW(dir, amd64);
            break;
    }

    return TRUE;
}
开发者ID:r6144,项目名称:wine,代码行数:28,代码来源:asmcache.c


示例10: sizeof

void TCCFrm::FrmCopyFileToClipboard()
{
    HGLOBAL hGblFiles;
    unsigned char *gblBuf;
    DROPFILES dropFiles;
    WCHAR szWinDir[MAX_PATH];
    WCHAR filename[1024];
    int lenWinDir, flen, len;
    dropFiles.pFiles = sizeof(DROPFILES);
    dropFiles.pt.x = 0;
    dropFiles.pt.y = 0;
    dropFiles.fNC = FALSE;
    dropFiles.fWide = TRUE;
    GetWindowsDirectoryW(szWinDir, MAX_PATH);
    lenWinDir = wcslen(szWinDir);
    memset(filename, 0, 1024 * sizeof(WCHAR));
    memcpy(filename, szWinDir, lenWinDir * sizeof(WCHAR));
    memcpy(filename + lenWinDir, L"\\Fonts\\", 7 * sizeof(WCHAR));
    GetWindowTextW(m_hEditFileName, filename + lenWinDir + 7, 512);
    flen = wcslen(filename) + 2;
    len = sizeof(DROPFILES) + flen * sizeof(WCHAR) + 2;
    hGblFiles = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE, len);
    gblBuf = (unsigned char *)GlobalLock(hGblFiles);
    memcpy(gblBuf, &dropFiles, sizeof(DROPFILES));
    memcpy(gblBuf + sizeof(DROPFILES), filename, flen * sizeof(WCHAR));
    GlobalUnlock(hGblFiles);
    OpenClipboard(NULL);
    EmptyClipboard();
    SetClipboardData(CF_HDROP, hGblFiles);
    CloseClipboard();
}
开发者ID:Lichtavat,项目名称:TCAX,代码行数:31,代码来源:fontColor.cpp


示例11: GetWindowsDirectoryW

StString StProcess::getWindowsFolder() {
    StString aWinFolder;
    stUtfWide_t aWndFldr[MAX_PATH];
    GetWindowsDirectoryW(aWndFldr, MAX_PATH);
    aWndFldr[MAX_PATH - 1] = L'\0';
    aWinFolder = StString(aWndFldr) + SYS_FS_SPLITTER;
    return aWinFolder;
}
开发者ID:angelstudio,项目名称:sview,代码行数:8,代码来源:StProcess.cpp


示例12: InitializeSystemDialog

static BOOL
InitializeSystemDialog(HWND hDlg)
{
    WCHAR winDir[PATH_MAX];

    GetWindowsDirectoryW(winDir, PATH_MAX);
    return LoadSystemIni(winDir, hDlg);
}
开发者ID:rmallof,项目名称:reactos,代码行数:8,代码来源:systempage.c


示例13: GetSystemWindowsDirectoryW

/*
 * @implemented
 */
UINT
WINAPI
GetSystemWindowsDirectoryW(
	LPWSTR	lpBuffer,
	UINT	uSize
	)
{
    return GetWindowsDirectoryW( lpBuffer, uSize );
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:12,代码来源:curdir.c


示例14: GetTempPathW

/*
 * @implemented
 *
 * ripped from wine
 */
DWORD
WINAPI
GetTempPathW (
	DWORD	count,
   LPWSTR   path
	)
{
    static const WCHAR tmp[]  = { 'T', 'M', 'P', 0 };
    static const WCHAR temp[] = { 'T', 'E', 'M', 'P', 0 };
    static const WCHAR userprofile[] = { 'U','S','E','R','P','R','O','F','I','L','E',0 };
    WCHAR tmp_path[MAX_PATH];
    UINT ret;

    TRACE("%u,%p\n", count, path);

    if (!(ret = GetEnvironmentVariableW( tmp, tmp_path, MAX_PATH )) &&
        !(ret = GetEnvironmentVariableW( temp, tmp_path, MAX_PATH )) &&
        !(ret = GetEnvironmentVariableW( userprofile, tmp_path, MAX_PATH )) &&
        !(ret = GetWindowsDirectoryW( tmp_path, MAX_PATH )))
        return 0;

   if (ret > MAX_PATH)
   {
     SetLastError(ERROR_FILENAME_EXCED_RANGE);
     return 0;
   }

   ret = GetFullPathNameW(tmp_path, MAX_PATH, tmp_path, NULL);
   if (!ret) return 0;

   if (ret > MAX_PATH - 2)
   {
     SetLastError(ERROR_FILENAME_EXCED_RANGE);
     return 0;
   }

   if (tmp_path[ret-1] != '\\')
   {
     tmp_path[ret++] = '\\';
     tmp_path[ret]   = '\0';
   }

   ret++; /* add space for terminating 0 */

   if (count)
   {
     lstrcpynW(path, tmp_path, count);
     if (count >= ret)
         ret--; /* return length without 0 */
     else if (count < 4)
         path[0] = 0; /* avoid returning ambiguous "X:" */
   }

   TRACE("GetTempPathW returning %u, %S\n", ret, path);
   return ret;

}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:62,代码来源:curdir.c


示例15: GetWindowsFontPath

static char* GetWindowsFontPath()
{
    wchar_t wdir[MAX_PATH];
    if( S_OK != SHGetFolderPathW( NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir ) )
    {
        GetWindowsDirectoryW( wdir, MAX_PATH );
        wcscat( wdir, L"\\fonts" );
    }
    return FromWide( wdir );
}
开发者ID:nunoneto,项目名称:vlc,代码行数:10,代码来源:platform_fonts.c


示例16: ProcessStartupItems

INT ProcessStartupItems(VOID)
{
    /* TODO: ProcessRunKeys already checks SM_CLEANBOOT -- items prefixed with * should probably run even in safe mode */
    BOOL bNormalBoot = GetSystemMetrics(SM_CLEANBOOT) == 0; /* Perform the operations that are performed every boot */
    /* First, set the current directory to SystemRoot */
    WCHAR gen_path[MAX_PATH];
    DWORD res;

    res = GetWindowsDirectoryW(gen_path, _countof(gen_path));
    if (res == 0)
    {
        TRACE("Couldn't get the windows directory - error %lu\n", GetLastError());

        return 100;
    }

    if (!SetCurrentDirectoryW(gen_path))
    {
        TRACE("Cannot set the dir to %ls (%lu)\n", gen_path, GetLastError());

        return 100;
    }

    /* Perform the operations by order checking if policy allows it, checking if this is not Safe Mode,
     * stopping if one fails, skipping if necessary.
     */
    res = TRUE;
    /* TODO: RunOnceEx */

    if (res && (SHRestricted(REST_NOLOCALMACHINERUNONCE) == 0))
        res = ProcessRunKeys(HKEY_LOCAL_MACHINE, L"RunOnce", TRUE, TRUE);

    if (res && bNormalBoot && (SHRestricted(REST_NOLOCALMACHINERUN) == 0))
        res = ProcessRunKeys(HKEY_LOCAL_MACHINE, L"Run", FALSE, FALSE);

    if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) == 0))
        res = ProcessRunKeys(HKEY_CURRENT_USER, L"Run", FALSE, FALSE);

    /* All users Startup folder */
    AutoStartupApplications(CSIDL_COMMON_STARTUP);

    /* Current user Startup folder */
    AutoStartupApplications(CSIDL_STARTUP);

    /* TODO: HKCU\RunOnce runs even if StartupHasBeenRun exists */
    if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) == 0))
        res = ProcessRunKeys(HKEY_CURRENT_USER, L"RunOnce", TRUE, FALSE);

    TRACE("Operation done\n");

    return res ? 0 : 101;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:52,代码来源:startup.cpp


示例17: resolve_filename

static BOOL resolve_filename(const WCHAR *filename, WCHAR *fullname, DWORD buflen)
{
    static const WCHAR helpW[] = {'\\','h','e','l','p','\\',0};

    GetFullPathNameW(filename, buflen, fullname, NULL);
    if (GetFileAttributesW(fullname) == INVALID_FILE_ATTRIBUTES)
    {
        GetWindowsDirectoryW(fullname, buflen);
        strcatW(fullname, helpW);
        strcatW(fullname, filename);
    }
    return (GetFileAttributesW(fullname) != INVALID_FILE_ATTRIBUTES);
}
开发者ID:r6144,项目名称:wine,代码行数:13,代码来源:hhctrl.c


示例18: GetWindowsDirectoryW

void hsWFolderIterator::SetWinSystemDir(const wchar_t subdir[])
{
    int ret = GetWindowsDirectoryW(fPath, _MAX_PATH);
    hsAssert(ret != 0, "Error getting windows directory in UseWindowsFontsPath");

    if (subdir)
    {
        wcscat(fPath, L"\\");
        wcscat(fPath, subdir);
        wcscat(fPath, L"\\");
    }
    Reset();
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:13,代码来源:hsFiles_Win.cpp


示例19: get_mono_path

static BOOL get_mono_path(LPWSTR path)
{
    static const WCHAR subdir_mono[] = {'\\','m','o','n','o',0};
    static const WCHAR sibling_mono[] = {'\\','.','.','\\','m','o','n','o',0};
    WCHAR base_path[MAX_PATH];
    const char *unix_data_dir;
    WCHAR *dos_data_dir;
    BOOL build_tree = FALSE;
    static WCHAR* (CDECL *wine_get_dos_file_name)(const char*);

    /* First try c:\windows\mono */
    GetWindowsDirectoryW(base_path, MAX_PATH);
    strcatW(base_path, subdir_mono);

    if (get_mono_path_from_folder(base_path, path))
        return TRUE;

    /* Next: /usr/share/wine/mono */
    unix_data_dir = wine_get_data_dir();

    if (!unix_data_dir)
    {
        unix_data_dir = wine_get_build_dir();
        build_tree = TRUE;
    }

    if (unix_data_dir)
    {
        if (!wine_get_dos_file_name)
            wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "wine_get_dos_file_name");

        if (wine_get_dos_file_name)
        {
            dos_data_dir = wine_get_dos_file_name(unix_data_dir);

            if (dos_data_dir)
            {
                strcpyW(base_path, dos_data_dir);
                strcatW(base_path, build_tree ? sibling_mono : subdir_mono);

                HeapFree(GetProcessHeap(), 0, dos_data_dir);

                if (get_mono_path_from_folder(base_path, path))
                    return TRUE;
            }
        }
    }

    /* Last: the registry */
    return get_mono_path_from_registry(path);
}
开发者ID:AlexSteel,项目名称:wine,代码行数:51,代码来源:metahost.c


示例20: create_manifest

static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
                             const xmlstr_t *version, const xmlstr_t *lang, const void *data, DWORD len )
{
    static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\','m','a','n','i','f','e','s','t','s','\\'};
    static const WCHAR extensionW[] = {'.','m','a','n','i','f','e','s','t',0};
    WCHAR *path;
    DWORD pos, written, path_len;
    HANDLE handle;
    BOOL ret = FALSE;

    path_len = GetWindowsDirectoryW( NULL, 0 ) + 1 + sizeof(winsxsW)/sizeof(WCHAR)
        + arch->len + name->len + key->len + version->len + 18 + sizeof(extensionW)/sizeof(WCHAR);

    path = HeapAlloc( GetProcessHeap(), 0, path_len * sizeof(WCHAR) );
    pos = GetWindowsDirectoryW( path, MAX_PATH );
    path[pos++] = '\\';
    memcpy( path + pos, winsxsW, sizeof(winsxsW) );
    pos += sizeof(winsxsW) / sizeof(WCHAR);
    get_manifest_filename( arch, name, key, version, lang, path + pos, MAX_PATH - pos );
    strcatW( path + pos, extensionW );
    handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
    if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND)
    {
        create_directories( path );
        handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
    }

    if (handle != INVALID_HANDLE_VALUE)
    {
        TRACE( "creating %s\n", debugstr_w(path) );
        ret = (WriteFile( handle, data, len, &written, NULL ) && written == len);
        if (!ret) ERR( "failed to write to %s (error=%u)\n", debugstr_w(path), GetLastError() );
        CloseHandle( handle );
        if (!ret) DeleteFileW( path );
    }
    HeapFree( GetProcessHeap(), 0, path );
    return ret;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:38,代码来源:fakedll.c



注:本文中的GetWindowsDirectoryW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetWindowsVersion函数代码示例发布时间:2022-05-30
下一篇:
C++ GetWindowsDirectory函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap