From b9fc3f8eb1064df6a624512a90c2d9b4bb335a1f Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Tue, 18 Apr 2006 16:14:34 -0500 Subject: [PATCH] advpack: Set the destination directory to the working directory if key equals SourceDir. --- dlls/advpack/advpack.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c index 3ceb70ab613..791cb882800 100644 --- a/dlls/advpack/advpack.c +++ b/dlls/advpack/advpack.c @@ -92,7 +92,7 @@ static void get_dest_dir(HINF hInf, PCWSTR pszSection, PWSTR pszBuffer, DWORD dw } /* loads the LDIDs specified in the install section of an INF */ -static void set_ldids(HINF hInf, LPCWSTR pszInstallSection) +static void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) { WCHAR field[MAX_FIELD_LENGTH]; WCHAR line[MAX_FIELD_LENGTH]; @@ -101,6 +101,8 @@ static void set_ldids(HINF hInf, LPCWSTR pszInstallSection) DWORD size; int ldid; + static const WCHAR source_dir[] = {'S','o','u','r','c','e','D','i','r',0}; + static const WCHAR custDestW[] = { 'C','u','s','t','o','m','D','e','s','t','i','n','a','t','i','o','n',0 }; @@ -145,7 +147,11 @@ static void set_ldids(HINF hInf, LPCWSTR pszInstallSection) if (ptr) *ptr = '\0'; - get_dest_dir(hInf, value, dest, MAX_PATH); + /* set dest to pszWorkingDir if key is SourceDir */ + if (pszWorkingDir && !lstrcmpiW(value, source_dir)) + lstrcpynW(dest, pszWorkingDir, MAX_PATH); + else + get_dest_dir(hInf, value, dest, MAX_PATH); /* set all ldids to dest */ while ((ptr = get_parameter(&key, ','))) @@ -359,7 +365,7 @@ HRESULT WINAPI OpenINFEngineW(LPCWSTR pszInfFilename, LPCWSTR pszInstallSection, if (*phInf == INVALID_HANDLE_VALUE) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - set_ldids(*phInf, pszInstallSection); + set_ldids(*phInf, pszInstallSection, NULL); return S_OK; } @@ -717,7 +723,7 @@ HRESULT WINAPI TranslateInfStringW(LPCWSTR pszInfFilename, LPCWSTR pszInstallSec if (hInf == INVALID_HANDLE_VALUE) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - set_ldids(hInf, pszInstallSection); + set_ldids(hInf, pszInstallSection, NULL); if (!SetupGetLineTextW(NULL, hInf, pszTranslateSection, pszTranslateKey, pszBuffer, dwBufferSize, pdwRequiredSize)) -- 2.11.4.GIT