msi/tests: Drop workarounds for Windows 2000.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
783c2d66a4
commit
6a3e79b002
|
@ -1,5 +1,5 @@
|
|||
TESTDLL = msi.dll
|
||||
IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version odbccp32
|
||||
IMPORTS = secur32 cabinet msi shell32 ole32 oleaut32 user32 advapi32 version odbccp32
|
||||
|
||||
custom_IMPORTS = uuid msi ole32 shell32 advapi32 odbccp32 oleaut32
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <shellapi.h>
|
||||
#include <winsvc.h>
|
||||
#include <odbcinst.h>
|
||||
#include <sddl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "utils.h"
|
||||
|
@ -50,11 +51,9 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
|
|||
static UINT (WINAPI *pMsiQueryFeatureStateExA)
|
||||
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
|
||||
static HMODULE hsrclient;
|
||||
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
|
||||
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
|
||||
|
||||
|
@ -2356,6 +2355,7 @@ static void init_functionpointers(void)
|
|||
HMODULE hmsi = GetModuleHandleA("msi.dll");
|
||||
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
|
||||
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
HMODULE hsrclient = LoadLibraryA("srclient.dll");
|
||||
|
||||
#define GET_PROC(mod, func) \
|
||||
p ## func = (void*)GetProcAddress(mod, #func); \
|
||||
|
@ -2368,11 +2368,9 @@ static void init_functionpointers(void)
|
|||
GET_PROC(hmsi, MsiGetComponentPathExA);
|
||||
GET_PROC(hmsi, MsiQueryFeatureStateExA);
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA);
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
|
||||
hsrclient = LoadLibraryA("srclient.dll");
|
||||
GET_PROC(hsrclient, SRRemoveRestorePoint);
|
||||
GET_PROC(hsrclient, SRSetRestorePointA);
|
||||
|
||||
|
@ -2386,17 +2384,12 @@ static char *get_user_sid(void)
|
|||
TOKEN_USER *user;
|
||||
char *usersid = NULL;
|
||||
|
||||
if (!pConvertSidToStringSidA)
|
||||
{
|
||||
win_skip("ConvertSidToStringSidA is not available\n");
|
||||
return NULL;
|
||||
}
|
||||
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
|
||||
GetTokenInformation(token, TokenUser, NULL, size, &size);
|
||||
|
||||
user = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
GetTokenInformation(token, TokenUser, user, size, &size);
|
||||
pConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
ConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
|
||||
CloseHandle(token);
|
||||
|
@ -6467,7 +6460,6 @@ START_TEST(action)
|
|||
if (ret)
|
||||
remove_restore_point(status.llSequenceNumber);
|
||||
}
|
||||
FreeLibrary(hsrclient);
|
||||
|
||||
SetCurrentDirectoryA(prev_path);
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
|
||||
static BOOL is_wow64;
|
||||
|
||||
static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
|
||||
static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
|
||||
|
@ -219,8 +217,6 @@ static void init_functionpointers(void)
|
|||
if(!p ## func) \
|
||||
trace("GetProcAddress(%s) failed\n", #func);
|
||||
|
||||
GET_PROC(hadvapi32, CheckTokenMembership);
|
||||
GET_PROC(hadvapi32, OpenProcessToken);
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
|
||||
|
@ -234,11 +230,9 @@ static BOOL is_process_limited(void)
|
|||
BOOL IsInGroup;
|
||||
HANDLE token;
|
||||
|
||||
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
|
||||
|
||||
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
|
||||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
|
||||
!CheckTokenMembership(NULL, Group, &IsInGroup))
|
||||
{
|
||||
trace("Could not check if the current user is an administrator\n");
|
||||
FreeSid(Group);
|
||||
|
@ -252,7 +246,7 @@ static BOOL is_process_limited(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
BOOL ret;
|
||||
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
||||
|
|
|
@ -44,13 +44,11 @@ static UINT (WINAPI *pMsiSourceListEnumSourcesA)
|
|||
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
|
||||
(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **);
|
||||
static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *);
|
||||
|
||||
static HMODULE hsrclient = 0;
|
||||
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
|
||||
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
|
||||
|
||||
|
@ -2146,6 +2144,7 @@ static void init_functionpointers(void)
|
|||
HMODULE hmsi = GetModuleHandleA("msi.dll");
|
||||
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
|
||||
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
HMODULE hsrclient = LoadLibraryA("srclient.dll");
|
||||
|
||||
#define GET_PROC(mod, func) \
|
||||
p ## func = (void*)GetProcAddress(mod, #func); \
|
||||
|
@ -2156,13 +2155,11 @@ static void init_functionpointers(void)
|
|||
GET_PROC(hmsi, MsiSourceListEnumSourcesA);
|
||||
GET_PROC(hmsi, MsiGetComponentPathExA);
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA);
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
GET_PROC(hkernel32, Wow64DisableWow64FsRedirection);
|
||||
GET_PROC(hkernel32, Wow64RevertWow64FsRedirection);
|
||||
|
||||
hsrclient = LoadLibraryA("srclient.dll");
|
||||
GET_PROC(hsrclient, SRRemoveRestorePoint);
|
||||
GET_PROC(hsrclient, SRSetRestorePointA);
|
||||
|
||||
|
@ -6294,7 +6291,6 @@ START_TEST(install)
|
|||
if (ret)
|
||||
remove_restore_point(status.llSequenceNumber);
|
||||
}
|
||||
FreeLibrary(hsrclient);
|
||||
|
||||
SetCurrentDirectoryA(prev_path);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ static BOOL is_wow64;
|
|||
static const char msifile[] = "winetest.msi";
|
||||
static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','.','m','s','i',0};
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
|
||||
|
@ -104,7 +103,6 @@ static void init_functionpointers(void)
|
|||
GET_PROC(hmsi, MsiEnumComponentsExA)
|
||||
GET_PROC(hmsi, MsiSourceListGetInfoA)
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA)
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
|
||||
|
@ -1180,7 +1178,7 @@ static char *get_user_sid(void)
|
|||
|
||||
user = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
GetTokenInformation(token, TokenUser, user, size, &size);
|
||||
pConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
ConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
|
||||
CloseHandle(token);
|
||||
|
@ -14445,33 +14443,26 @@ START_TEST(msi)
|
|||
test_MsiGetFileHash();
|
||||
test_MsiSetInternalUI();
|
||||
test_MsiSetExternalUI();
|
||||
|
||||
if (!pConvertSidToStringSidA)
|
||||
win_skip("ConvertSidToStringSidA not implemented\n");
|
||||
else
|
||||
{
|
||||
/* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
|
||||
test_MsiQueryProductState();
|
||||
test_MsiQueryFeatureState();
|
||||
test_MsiQueryComponentState();
|
||||
test_MsiGetComponentPath();
|
||||
test_MsiGetComponentPathEx();
|
||||
test_MsiProvideComponent();
|
||||
test_MsiGetProductCode();
|
||||
test_MsiEnumClients();
|
||||
test_MsiGetProductInfo();
|
||||
test_MsiGetProductInfoEx();
|
||||
test_MsiGetUserInfo();
|
||||
test_MsiOpenProduct();
|
||||
test_MsiEnumPatchesEx();
|
||||
test_MsiEnumPatches();
|
||||
test_MsiGetPatchInfoEx();
|
||||
test_MsiGetPatchInfo();
|
||||
test_MsiEnumProducts();
|
||||
test_MsiEnumProductsEx();
|
||||
test_MsiEnumComponents();
|
||||
test_MsiEnumComponentsEx();
|
||||
}
|
||||
test_MsiQueryProductState();
|
||||
test_MsiQueryFeatureState();
|
||||
test_MsiQueryComponentState();
|
||||
test_MsiGetComponentPath();
|
||||
test_MsiGetComponentPathEx();
|
||||
test_MsiProvideComponent();
|
||||
test_MsiGetProductCode();
|
||||
test_MsiEnumClients();
|
||||
test_MsiGetProductInfo();
|
||||
test_MsiGetProductInfoEx();
|
||||
test_MsiGetUserInfo();
|
||||
test_MsiOpenProduct();
|
||||
test_MsiEnumPatchesEx();
|
||||
test_MsiEnumPatches();
|
||||
test_MsiGetPatchInfoEx();
|
||||
test_MsiGetPatchInfo();
|
||||
test_MsiEnumProducts();
|
||||
test_MsiEnumProductsEx();
|
||||
test_MsiEnumComponents();
|
||||
test_MsiEnumComponentsEx();
|
||||
test_MsiGetFileVersion();
|
||||
test_MsiGetFileSignatureInformation();
|
||||
test_MsiConfigureProductEx();
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <msiquery.h>
|
||||
#include <srrestoreptapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <sddl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
|
@ -39,18 +40,10 @@ static const WCHAR msifileW[] =
|
|||
static char CURR_DIR[MAX_PATH];
|
||||
|
||||
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
|
||||
static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
|
||||
|
||||
static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
static void (WINAPI *pGetSystemInfo)(LPSYSTEM_INFO);
|
||||
static void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO);
|
||||
static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR, UINT);
|
||||
|
||||
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
|
||||
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
|
||||
|
||||
|
@ -59,28 +52,20 @@ static void init_functionpointers(void)
|
|||
HMODULE hmsi = GetModuleHandleA("msi.dll");
|
||||
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
|
||||
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
HMODULE hshell32 = GetModuleHandleA("shell32.dll");
|
||||
HMODULE hsrclient;
|
||||
HMODULE hsrclient = LoadLibraryA("srclient.dll");
|
||||
|
||||
#define GET_PROC(mod, func) \
|
||||
p ## func = (void*)GetProcAddress(mod, #func);
|
||||
|
||||
GET_PROC(hmsi, MsiGetComponentPathExA);
|
||||
GET_PROC(hshell32, SHGetFolderPathA);
|
||||
|
||||
GET_PROC(hadvapi32, CheckTokenMembership);
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA);
|
||||
GET_PROC(hadvapi32, OpenProcessToken);
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExW)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
GET_PROC(hkernel32, GetNativeSystemInfo)
|
||||
GET_PROC(hkernel32, GetSystemInfo)
|
||||
GET_PROC(hkernel32, GetSystemWow64DirectoryA)
|
||||
|
||||
hsrclient = LoadLibraryA("srclient.dll");
|
||||
GET_PROC(hsrclient, SRRemoveRestorePoint);
|
||||
GET_PROC(hsrclient, SRSetRestorePointA);
|
||||
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
|
@ -91,11 +76,9 @@ static BOOL is_process_limited(void)
|
|||
BOOL IsInGroup;
|
||||
HANDLE token;
|
||||
|
||||
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
|
||||
|
||||
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
|
||||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
|
||||
!CheckTokenMembership(NULL, Group, &IsInGroup))
|
||||
{
|
||||
trace("Could not check if the current user is an administrator\n");
|
||||
FreeSid(Group);
|
||||
|
@ -109,7 +92,7 @@ static BOOL is_process_limited(void)
|
|||
SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_POWER_USERS,
|
||||
0, 0, 0, 0, 0, 0, &Group) ||
|
||||
!pCheckTokenMembership(NULL, Group, &IsInGroup))
|
||||
!CheckTokenMembership(NULL, Group, &IsInGroup))
|
||||
{
|
||||
trace("Could not check if the current user is a power user\n");
|
||||
return FALSE;
|
||||
|
@ -121,7 +104,7 @@ static BOOL is_process_limited(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
BOOL ret;
|
||||
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
||||
|
@ -148,17 +131,12 @@ static char *get_user_sid(void)
|
|||
TOKEN_USER *user;
|
||||
char *usersid = NULL;
|
||||
|
||||
if (!pConvertSidToStringSidA)
|
||||
{
|
||||
win_skip("ConvertSidToStringSidA is not available\n");
|
||||
return NULL;
|
||||
}
|
||||
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
|
||||
GetTokenInformation(token, TokenUser, NULL, size, &size);
|
||||
|
||||
user = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
GetTokenInformation(token, TokenUser, user, size, &size);
|
||||
pConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
ConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
|
||||
CloseHandle(token);
|
||||
|
@ -4705,7 +4683,7 @@ static void test_appsearch_reglocator(void)
|
|||
ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
|
||||
|
||||
memset(&si, 0, sizeof(si));
|
||||
if (pGetNativeSystemInfo) pGetNativeSystemInfo(&si);
|
||||
GetNativeSystemInfo(&si);
|
||||
|
||||
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
|
||||
{
|
||||
|
@ -5721,10 +5699,7 @@ static void test_installprops(void)
|
|||
r = MsiGetPropertyA(hpkg, "MsiNetAssemblySupport", buf, &size);
|
||||
if (r == ERROR_SUCCESS) trace( "MsiNetAssemblySupport \"%s\"\n", buf );
|
||||
|
||||
if (pGetNativeSystemInfo)
|
||||
pGetNativeSystemInfo(&si);
|
||||
else
|
||||
pGetSystemInfo(&si);
|
||||
GetNativeSystemInfo(&si);
|
||||
|
||||
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
||||
{
|
||||
|
@ -5739,7 +5714,7 @@ static void test_installprops(void)
|
|||
strcat(path, "\\");
|
||||
check_prop(hpkg, "System64Folder", path);
|
||||
|
||||
pGetSystemWow64DirectoryA(path, MAX_PATH);
|
||||
GetSystemWow64DirectoryA(path, MAX_PATH);
|
||||
strcat(path, "\\");
|
||||
check_prop(hpkg, "SystemFolder", path);
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCON
|
|||
LPCSTR, LPSTR, DWORD * );
|
||||
static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR,
|
||||
LPSTR, MSIINSTALLCONTEXT *, LPSTR, LPDWORD );
|
||||
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
|
||||
|
||||
static const char *msifile = "winetest-patch.msi";
|
||||
static const char *mspfile = "winetest-patch.msp";
|
||||
|
@ -145,7 +144,6 @@ static const struct msi_table tables[] =
|
|||
static void init_function_pointers( void )
|
||||
{
|
||||
HMODULE hmsi = GetModuleHandleA( "msi.dll" );
|
||||
HMODULE hadvapi32 = GetModuleHandleA( "advapi32.dll" );
|
||||
|
||||
#define GET_PROC( mod, func ) \
|
||||
p ## func = (void *)GetProcAddress( mod, #func ); \
|
||||
|
@ -156,7 +154,6 @@ static void init_function_pointers( void )
|
|||
GET_PROC( hmsi, MsiGetPatchInfoExA );
|
||||
GET_PROC( hmsi, MsiEnumPatchesExA );
|
||||
|
||||
GET_PROC( hadvapi32, OpenProcessToken );
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
|
@ -164,9 +161,7 @@ static BOOL is_process_limited(void)
|
|||
{
|
||||
HANDLE token;
|
||||
|
||||
if (!pOpenProcessToken) return FALSE;
|
||||
|
||||
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
BOOL ret;
|
||||
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
|
||||
static BOOL is_wow64;
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
|
||||
static UINT (WINAPI *pMsiSourceListAddMediaDiskA)
|
||||
|
@ -60,7 +58,6 @@ static void init_functionpointers(void)
|
|||
HMODULE hmsi = GetModuleHandleA("msi.dll");
|
||||
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
|
||||
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
HMODULE hsecur32 = LoadLibraryA("secur32.dll");
|
||||
|
||||
#define GET_PROC(dll, func) \
|
||||
p ## func = (void *)GetProcAddress(dll, #func); \
|
||||
|
@ -75,10 +72,8 @@ static void init_functionpointers(void)
|
|||
GET_PROC(hmsi, MsiSourceListSetInfoA)
|
||||
GET_PROC(hmsi, MsiSourceListAddSourceA)
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA)
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
GET_PROC(hsecur32, GetUserNameExA)
|
||||
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
@ -142,17 +137,12 @@ static char *get_user_sid(void)
|
|||
TOKEN_USER *user;
|
||||
char *usersid = NULL;
|
||||
|
||||
if (!pConvertSidToStringSidA)
|
||||
{
|
||||
win_skip("ConvertSidToStringSidA is not available\n");
|
||||
return NULL;
|
||||
}
|
||||
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
|
||||
GetTokenInformation(token, TokenUser, NULL, size, &size);
|
||||
|
||||
user = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
GetTokenInformation(token, TokenUser, user, size, &size);
|
||||
pConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
ConvertSidToStringSidA(user->User.Sid, &usersid);
|
||||
HeapFree(GetProcessHeap(), 0, user);
|
||||
|
||||
CloseHandle(token);
|
||||
|
@ -3241,7 +3231,7 @@ static void test_MsiSourceListAddSource(void)
|
|||
CHAR prod_squashed[MAX_PATH];
|
||||
CHAR keypath[MAX_PATH*2];
|
||||
CHAR username[MAX_PATH];
|
||||
LPSTR usersid, ptr;
|
||||
LPSTR usersid;
|
||||
LONG res;
|
||||
UINT r;
|
||||
HKEY prodkey, userkey, net, source;
|
||||
|
@ -3263,16 +3253,7 @@ static void test_MsiSourceListAddSource(void)
|
|||
|
||||
/* MACHINENAME\username */
|
||||
size = MAX_PATH;
|
||||
if (pGetUserNameExA != NULL)
|
||||
pGetUserNameExA(NameSamCompatible, username, &size);
|
||||
else
|
||||
{
|
||||
GetComputerNameA(username, &size);
|
||||
lstrcatA(username, "\\");
|
||||
ptr = username + lstrlenA(username);
|
||||
size = MAX_PATH - (ptr - username);
|
||||
GetUserNameA(ptr, &size);
|
||||
}
|
||||
GetUserNameExA(NameSamCompatible, username, &size);
|
||||
trace("username: %s\n", username);
|
||||
|
||||
if (is_wow64)
|
||||
|
|
Loading…
Reference in New Issue