sizeof(TEST_ITEM));
if (pItem)
{
- if (lpDll)
- wcsncpy(pItem->szSelectedDll, lpDll, MAX_PATH);
- if (lpRun)
- wcsncpy(pItem->szRunString, lpRun, MAX_RUN_CMD);
+ if (lpName)
+ {
+ wcsncpy(pItem->szName, lpName, MAX_PATH);
- }
++ }
+ if (lpRunCmd)
+ {
+ wcsncpy(pItem->szRunCmd, lpRunCmd, MAX_RUN_CMD);
+ }
}
return pItem;
hParent = InsertIntoTreeView(pInfo->hBrowseTV,
hRoot,
lpTestName,
- pTestItem,
+ (LPARAM)pTestItem,
IL_TEST,
HAS_CHILD);
- if (hParent)
- {
- /* Get the list of modules a dll offers. This is returned as list of
- * Ansi null-terminated strings, terminated with an empty string (double null) */
- GetModulesInTest = (MODULES)GetProcAddress(hDll, "GetModulesInTest");
- if ((numMods = GetModulesInTest(&lpModules)))
- {
- ptr = lpModules;
- while (numMods && *ptr != '\0')
- {
- /* convert the string to unicode */
- if (AnsiToUnicode(ptr, &lpModW))
- {
- WCHAR szRunCmd[MAX_RUN_CMD];
-
- _snwprintf(szRunCmd, MAX_RUN_CMD, L"%s:%s", lpTestName, lpModW);
- pTestItem = BuildTestItemData(lpDllPath, szRunCmd);
-
- InsertIntoTreeView(pInfo->hBrowseTV,
- hParent,
- lpModW,
- pTestItem,
- IL_TEST,
- HAS_NO_CHILD);
-
- HeapFree(GetProcessHeap(), 0, lpModW);
- }
- }
- }
+ }
-
- /* move onto next string */
- while (*(ptr++) != '\0')
- ;
-
- numMods--;
+ }
-
- HeapFree(GetProcessHeap(), 0, lpModules);
+ }
- }
- }
-
- FreeLibrary(hDll);
- }
- }
if (hRoot)
{
CAPTION "Test hierarchy"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- PUSHBUTTON "Select", IDOK, 202, 7, 50, 14
- PUSHBUTTON "Close", IDCANCEL, 202, 34, 50, 14
- CONTROL "", IDC_TREEVIEW, "SysTreeView32", WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT, 7, 7, 189, 236
+ PUSHBUTTON "Select", IDOK, 202, 7, 50, 14
+ PUSHBUTTON "Close", IDCANCEL, 202, 34, 50, 14
+ CONTROL "", IDC_TREEVIEW, "SysTreeView32", WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT, 7, 7, 189, 236
END
+
+ IDD_OPTIONS DIALOGEX 0, 0, 180, 100
+ STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+ CAPTION "Options"
+ FONT 8, "MS Shell Dlg", 0, 0, 0x1
+ BEGIN
+ PUSHBUTTON "OK", IDOK, 70, 80, 50, 14
+ PUSHBUTTON "Cancel", IDCANCEL, 125, 80, 50, 14
+ CONTROL "Hide console window",IDC_HIDECONSOLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,10,80,10
+ CONTROL "Run on start",IDC_RUNONSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,30,80,10
+ END
if (SendMessageW(hRunCmd,
CB_GETLBTEXT,
sel,
- szTextCmd) != CB_ERR)
+ (LPARAM)szTextCmd) != CB_ERR)
{
- lpDllPath = SendMessage(hRunCmd,
+ pInfo->lpCmdLine = (LPWSTR)SendMessage(hRunCmd,
- CB_GETITEMDATA,
- 0,
- 0);
+ CB_GETITEMDATA,
+ 0,
+ 0);
- if (lpDllPath)
+ if (pInfo->lpCmdLine)
{
- LPWSTR module = szTextCmd;
- LPSTR lpTest;
-
- while (*(module++) != L':' && *module != L'\0')
- ;
-
- if (*module)
- {
- if (UnicodeToAnsi(module, &lpTest))
- {
- HMODULE hDll;
- RUNTEST RunTest;
-
- hDll = LoadLibraryW(lpDllPath);
- if (hDll)
- {
- RunTest = (RUNTEST)GetProcAddress(hDll, "RunTest");
- if (RunTest)
- {
- RunTest(lpTest);
+ //
+ // Create a new thread to create the client process
+ // and recieve any ouput via stdout
+ //
+ CreateThread(NULL,
+ 0,
+ CreateClientProcess,
+ pInfo,
+ 0,
+ NULL);
- }
- }
- }
-}
+ }
-
- FreeLibrary(hDll);
+ }
- DisplayError(GetLastError());
-
- HeapFree(GetProcessHeap(), 0, lpTest);
+ }
+ }
- }
- }
- }
- }
-
static VOID
AddTestToCombo(PMAIN_WND_INFO pInfo)
{
{
for (i = 0; i < cnt; i++)
{
- lpDllPath = SendMessage(hRunCmd,
+ lpExePath = (LPWSTR)SendMessage(hRunCmd,
- CB_GETITEMDATA,
- i,
- 0);
+ CB_GETITEMDATA,
+ i,
+ 0);
- if (lpDllPath)
+ if (lpExePath)
{
- HeapFree(GetProcessHeap(), 0, lpDllPath);
+ HeapFree(GetProcessHeap(), 0, lpExePath);
}
}
}
/* Add all icons to the image list */
for (i = StartResource; i <= EndResource; i++)
{
- hIcon = (HBITMAP)LoadImageW(hInstance,
+ hIcon = (HICON)LoadImageW(hInstance,
- MAKEINTRESOURCEW(i),
- IMAGE_ICON,
- Width,
- Height,
- LR_DEFAULTCOLOR);
+ MAKEINTRESOURCEW(i),
+ IMAGE_ICON,
+ Width,
+ Height,
+ LR_DEFAULTCOLOR);
if (hIcon == NULL)
goto fail;
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="advapi32_winetest" type="win32cui" installbase="bin" installname="advapi32_winetest.exe" allowwarnings="true">
- <include base="advapi32_winetest">.</include>
+ <include base="advapi32_winetest">.</include>
- <define name="__USE_W32API" />
+ <define name="__ROS_LONG64__" />
- <library>advapi32</library>
- <library>ntdll</library>
- <library>uuid</library>
- <library>ole32</library>
- <file>cred.c</file>
- <file>crypt.c</file>
- <file>crypt_lmhash.c</file>
- <file>crypt_md4.c</file>
- <file>crypt_md5.c</file>
- <file>crypt_sha.c</file>
- <file>lsa.c</file>
- <file>registry.c</file>
- <file>security.c</file>
- <file>service.c</file>
- <file>testlist.c</file>
+ <library>advapi32</library>
- <library>kernel32</library>
+ <library>ntdll</library>
+ <library>uuid</library>
+ <library>ole32</library>
+ <file>cred.c</file>
+ <file>crypt.c</file>
+ <file>crypt_lmhash.c</file>
+ <file>crypt_md4.c</file>
+ <file>crypt_md5.c</file>
+ <file>crypt_sha.c</file>
+ <file>lsa.c</file>
+ <file>registry.c</file>
+ <file>security.c</file>
+ <file>service.c</file>
+ <file>testlist.c</file>
</module>
- </group>
RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwProvCount, pcbProvName,
NULL, NULL, NULL, NULL, NULL, NULL);
(*pcbProvName)++;
-
+
- if (!(*pszProvName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbProvName))))
+ if (!(*pszProvName = LocalAlloc(LMEM_ZEROINIT, *pcbProvName)))
return FALSE;
RegEnumKeyEx(hKey, dwIndex, *pszProvName, pcbProvName, NULL, NULL, NULL, NULL);
HKEY hKey;
HKEY hSubKey;
PSTR ch;
-
+ LPSTR szName;
+ DWORD cbName;
+ BOOL ret = FALSE;
+
if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types", &hKey))
return FALSE;
-
+
- if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, pcbTypeName, NULL,
+ if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, &cbName, NULL,
NULL, NULL, NULL, NULL, NULL))
- return FALSE;
- (*pcbTypeName)++;
+ goto cleanup;
+ cbName++;
-
+
- if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))))
- return FALSE;
+ if (!(szName = LocalAlloc(LMEM_ZEROINIT, cbName)))
+ goto cleanup;
-
+
- if (RegEnumKeyEx(hKey, dwIndex, *pszTypeName, pcbTypeName, NULL, NULL, NULL, NULL))
- return FALSE;
- (*pcbTypeName)++;
- ch = *pszTypeName + strlen(*pszTypeName);
+ while (!RegEnumKeyEx(hKey, *pdwIndex, szName, &cbName, NULL, NULL, NULL, NULL))
+ {
+ cbName++;
+ ch = szName + strlen(szName);
- /* Convert "Type 000" to 0, etc/ */
- *pdwProvType = *(--ch) - '0';
- *pdwProvType += (*(--ch) - '0') * 10;
- *pdwProvType += (*(--ch) - '0') * 100;
-
+ /* Convert "Type 000" to 0, etc/ */
+ *pdwProvType = *(--ch) - '0';
+ *pdwProvType += (*(--ch) - '0') * 10;
+ *pdwProvType += (*(--ch) - '0') * 100;
+
- if (RegOpenKey(hKey, *pszTypeName, &hSubKey))
- return FALSE;
+ if (RegOpenKey(hKey, szName, &hSubKey))
+ break;
-
+
- if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName))
- return FALSE;
+ if (!RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName))
+ {
+ if (!(*pszTypeName = LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))
+ break;
- if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))))
- return FALSE;
+ if (!RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, (LPBYTE)*pszTypeName, pcbTypeName))
+ {
+ ret = TRUE;
+ break;
+ }
-
+
- if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, (LPBYTE)*pszTypeName, pcbTypeName))
- return FALSE;
+ LocalFree(*pszTypeName);
+ }
-
- RegCloseKey(hSubKey);
+
+ RegCloseKey(hSubKey);
+
+ (*pdwIndex)++;
+ }
+
+ if (!ret)
+ LocalFree(*pszTypeName);
+ RegCloseKey(hSubKey);
+ LocalFree(szName);
+
+ cleanup:
RegCloseKey(hKey);
-
+
- return TRUE;
+ return ret;
}
static void test_enum_provider_types(void)
DWORD result;
DWORD notNull = 5;
DWORD notZeroFlags = 5;
-
+
if(!pCryptEnumProviderTypesA)
{
- skip("CryptEnumProviderTypesA is not available\n");
+ win_skip("CryptEnumProviderTypesA is not available\n");
- return;
+ return;
}
-
+
- if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount))
+ if (!FindProvTypesRegVals(&index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount))
{
- skip("Could not find provider types in registry\n");
- return;
+ skip("Could not find provider types in registry\n");
+ return;
}
-
+
/* check pdwReserved for NULL */
result = pCryptEnumProviderTypesA(index, ¬Null, 0, &provType, typeName, &typeNameSize);
- ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %d\n",
- ERROR_INVALID_PARAMETER, GetLastError());
+ ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n",
+ GetLastError());
-
+
/* check dwFlags == zero */
result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize);
- ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %d\n",
- ERROR_INVALID_PARAMETER, GetLastError());
+ ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected ERROR_INVALID_PARAMETER, got %d\n",
+ GetLastError());
-
+
+ /* This test fails under Win2k SP4:
+ * result = TRUE, GetLastError() == 0xdeadbeef */
+ if (0)
+ {
- /* alloc provider type to half the size required
- * cbTypeName holds the size required */
- typeNameSize = cbTypeName / 2;
+ /* alloc provider type to half the size required
+ * cbTypeName holds the size required */
+ typeNameSize = cbTypeName / 2;
- if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize))))
- return;
+ if (!(typeName = LocalAlloc(LMEM_ZEROINIT, typeNameSize)))
+ goto cleanup;
- /* This test fails under Win2k SP4:
- result = TRUE, GetLastError() == 0xdeadbeef
- SetLastError(0xdeadbeef);
- result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize);
+ SetLastError(0xdeadbeef);
+ result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize);
- ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n",
+ ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%d\n",
- result, GetLastError());
-
- LocalFree(typeName);
+ result, GetLastError());
- */
+
+ LocalFree(typeName);
+ }
-
+
/* loop through the provider types to get the number of provider types
* after loop ends, count should be dwTypeCount + 1 so subtract 1
* to get actual number of provider types */
* ERROR_NO_MORE_ITEMS */
for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++)
result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize);
- ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %d\n",
- ERROR_NO_MORE_ITEMS, GetLastError());
+ ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %d\n",
+ GetLastError());
-
+
-
/* check expected versus actual values returned */
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize);
ok(result && typeNameSize==cbTypeName, "expected %d, got %d\n", cbTypeName, typeNameSize);
- if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize))))
- return;
+ if (!(typeName = LocalAlloc(LMEM_ZEROINIT, typeNameSize)))
+ goto cleanup;
-
+
typeNameSize = 0xdeadbeef;
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize);
ok(result, "expected TRUE, got %d\n", result);
ok(provType==dwProvType, "expected %d, got %d\n", dwProvType, provType);
if (pszTypeName)
- ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName);
+ ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName);
ok(typeNameSize==cbTypeName, "expected %d, got %d\n", cbTypeName, typeNameSize);
-
+
LocalFree(typeName);
+ cleanup:
+ LocalFree(pszTypeName);
}
static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvName, DWORD *pcbProvName)
static void test_sha_ctx(void)
{
- FARPROC pA_SHAInit, pA_SHAUpdate, pA_SHAFinal;
- static const char test_buffer[] = "In our Life there's If"
+ void (WINAPI *pA_SHAInit)(PSHA_CTX);
+ void (WINAPI *pA_SHAUpdate)(PSHA_CTX, const unsigned char *, UINT);
+ void (WINAPI *pA_SHAFinal)(PSHA_CTX, PULONG);
+ static const unsigned char test_buffer[] = "In our Life there's If"
- "In our beliefs there's Lie"
- "In our business there is Sin"
- "In our bodies, there is Die";
+ "In our beliefs there's Lie"
+ "In our business there is Sin"
+ "In our bodies, there is Die";
- ULONG test_buffer_size = strlen(test_buffer);
HMODULE hmod;
SHA_CTX ctx;
ULONG result[5];
return;
}
- strcpy(directory, "\\Should not exist");
+ if (!GetTempPathA (sizeof (wintmpdir), wintmpdir)) {
+ win_skip ("GetTempPathA failed\n");
+ return;
+ }
+
+ /* Create a temporary directory and in it a temporary file */
+ strcat (strcpy (path, wintmpdir), "rary");
+ SetLastError(0xdeadbeef);
+ rc = CreateDirectoryA (path, NULL);
+ ok (rc || GetLastError() == ERROR_ALREADY_EXISTS, "CreateDirectoryA "
+ "failed for '%s' with %d\n", path, GetLastError());
+
+ strcat (strcpy (file, path), "\\ess");
+ SetLastError(0xdeadbeef);
+ fh = CreateFileA (file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ ok (fh != INVALID_HANDLE_VALUE, "CreateFileA "
+ "failed for '%s' with %d\n", file, GetLastError());
+ CloseHandle (fh);
+
+ /* For the temporary file ... */
+
+ /* Get size needed */
+ retSize = 0;
+ SetLastError(0xdeadbeef);
+ rc = pGetFileSecurityA (file, request, NULL, 0, &retSize);
+ if (!rc && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) {
+ win_skip("GetFileSecurityA is not implemented\n");
+ goto cleanup;
- }
++}
+ ok (!rc, "GetFileSecurityA "
+ "was expected to fail for '%s'\n", file);
+ ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA "
+ "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError());
+ ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA returned size %d\n", retSize);
+
+ sdSize = retSize;
+ sd = HeapAlloc (GetProcessHeap (), 0, sdSize);
+
+ /* Get security descriptor for real */
+ retSize = -1;
+ SetLastError(0xdeadbeef);
+ rc = pGetFileSecurityA (file, request, sd, sdSize, &retSize);
+ ok (rc, "GetFileSecurityA "
+ "was not expected to fail '%s': %d\n", file, GetLastError());
+ ok (retSize == sdSize ||
+ broken(retSize == 0), /* NT4 */
+ "GetFileSecurityA returned size %d; expected %d\n", retSize, sdSize);
+
+ /* Use it to set security descriptor */
+ SetLastError(0xdeadbeef);
+ rc = pSetFileSecurityA (file, request, sd);
+ ok (rc, "SetFileSecurityA "
+ "was not expected to fail '%s': %d\n", file, GetLastError());
+
+ HeapFree (GetProcessHeap (), 0, sd);
+
+ /* Repeat for the temporary directory ... */
- SetLastError(NO_ERROR);
- result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize);
- ok(!result, "GetFileSecurityA should fail for not existing directories/files\n");
- ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) ||
- (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) ,
- "last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) "
- "expected, got %d\n", GetLastError());
+ /* Get size needed */
+ retSize = 0;
+ SetLastError(0xdeadbeef);
+ rc = pGetFileSecurityA (path, request, NULL, 0, &retSize);
+ ok (!rc, "GetFileSecurityA "
+ "was expected to fail for '%s'\n", path);
+ ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA "
+ "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError());
+ ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA returned size %d\n", retSize);
+
+ sdSize = retSize;
+ sd = HeapAlloc (GetProcessHeap (), 0, sdSize);
+
+ /* Get security descriptor for real */
+ retSize = -1;
+ SetLastError(0xdeadbeef);
+ rc = pGetFileSecurityA (path, request, sd, sdSize, &retSize);
+ ok (rc, "GetFileSecurityA "
+ "was not expected to fail '%s': %d\n", path, GetLastError());
+ ok (retSize == sdSize ||
+ broken(retSize == 0), /* NT4 */
+ "GetFileSecurityA returned size %d; expected %d\n", retSize, sdSize);
+
+ /* Use it to set security descriptor */
+ SetLastError(0xdeadbeef);
+ rc = pSetFileSecurityA (path, request, sd);
+ ok (rc, "SetFileSecurityA "
+ "was not expected to fail '%s': %d\n", path, GetLastError());
+ HeapFree (GetProcessHeap (), 0, sd);
+
+ /* Old test */
+ strcpy (wintmpdir, "\\Should not exist");
+ SetLastError(0xdeadbeef);
+ rc = pGetFileSecurityA (wintmpdir, OWNER_SECURITY_INFORMATION, NULL, 0, &sdSize);
+ ok (!rc, "GetFileSecurityA should fail for not existing directories/files\n");
+ ok (GetLastError() == ERROR_FILE_NOT_FOUND,
+ "last error ERROR_FILE_NOT_FOUND expected, got %d\n", GetLastError());
+
+ cleanup:
+ /* Remove temporary file and directory */
+ DeleteFileA(file);
+ RemoveDirectoryA(path);
}
static void test_AccessCheck(void)
Domain[0] = '\0';
ret = LookupAccountSid(NULL, Groups->Groups[i].Sid, Name, &NameLength, Domain, &DomainLength, &SidNameUse);
if (ret)
- trace("\t%s, %s\\%s use: %d attr: 0x%08x\n", SidString, Domain, Name, SidNameUse, Groups->Groups[i].Attributes);
- else
- trace("\t%s, attr: 0x%08x LookupAccountSid failed with error %d\n", SidString, Groups->Groups[i].Attributes, GetLastError());
+ {
+ trace("%s, %s\\%s use: %d attr: 0x%08x\n", SidString, Domain, Name, SidNameUse, Groups->Groups[i].Attributes);
- LocalFree(SidString);
- }
+ LocalFree(SidString);
++ }
+ else trace("attr: 0x%08x LookupAccountSid failed with error %d\n", Groups->Groups[i].Attributes, GetLastError());
}
HeapFree(GetProcessHeap(), 0, Groups);
{
ok(!lstrcmp(account, user_name), "Expected %s, got %s\n", user_name, account);
ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain);
- ok(domain_size == domain_save - 1, "Expected %d, got %d\n", domain_save - 1, domain_size);
- ok(lstrlen(domain) == domain_size, "Expected %d\n", lstrlen(domain));
- ok(sid_use == SidTypeUser, "Expected SidTypeUser, got %d\n", sid_use);
}
- ok(domain_size == domain_save - 1, "Expected %d, got %d\n", domain_save - 1, domain_size);
++ ok(domain_size == domain_save - 1, "Expected %d, got %d\n", domain_save - 1, domain_size);
+ ok(lstrlen(domain) == domain_size, "Expected %d, got %d\n", lstrlen(domain), domain_size);
+ ok(sid_use == SidTypeUser, "Expected SidTypeUser (%d), got %d\n", SidTypeUser, sid_use);
domain_size = domain_save;
sid_size = sid_save;
sid_use = 0xcafebabe;
SetLastError(0xdeadbeef);
ret = LookupAccountNameA(NULL, NULL, NULL, &sid_size, NULL, &domain_size, &sid_use);
- ok(!ret, "Expected 0, got %d\n", ret);
- ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
- "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
- ok(sid_size != 0, "Expected non-zero sid size\n");
- ok(domain_size != 0, "Expected non-zero domain size\n");
- ok(sid_use == 0xcafebabe, "Expected 0xcafebabe, got %d\n", sid_use);
+ if (!ret && GetLastError() == ERROR_NONE_MAPPED)
+ win_skip("NULL account name doesn't work on NT4\n");
+ else
+ {
+ ok(!ret, "Expected 0, got %d\n", ret);
+ ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
+ "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
+ ok(sid_size != 0, "Expected non-zero sid size\n");
+ ok(domain_size != 0, "Expected non-zero domain size\n");
+ ok(sid_use == 0xcafebabe, "Expected 0xcafebabe, got %d\n", sid_use);
- psid = HeapAlloc(GetProcessHeap(), 0, sid_size);
- domain = HeapAlloc(GetProcessHeap(), 0, domain_size);
+ psid = HeapAlloc(GetProcessHeap(), 0, sid_size);
+ domain = HeapAlloc(GetProcessHeap(), 0, domain_size);
- /* try NULL account name */
- ret = LookupAccountNameA(NULL, NULL, psid, &sid_size, domain, &domain_size, &sid_use);
- get_sid_info(psid, &account, &sid_dom);
- ok(ret, "Failed to lookup account name\n");
+ /* try NULL account name */
+ ret = LookupAccountNameA(NULL, NULL, psid, &sid_size, domain, &domain_size, &sid_use);
+ get_sid_info(psid, &account, &sid_dom);
+ ok(ret, "Failed to lookup account name\n");
- todo_wine
- {
/* Using a fixed string will not work on different locales */
ok(!lstrcmp(account, domain),
"Got %s for account and %s for domain, these should be the same\n",
domain_size = 0;
ret = LookupAccountNameA(NULL, "oogabooga", NULL, &sid_size, NULL, &domain_size, &sid_use);
ok(!ret, "Expected 0, got %d\n", ret);
- todo_wine
- {
- ok(GetLastError() == ERROR_NONE_MAPPED,
+ ok(GetLastError() == ERROR_NONE_MAPPED ||
+ broken(GetLastError() == ERROR_TRUSTED_RELATIONSHIP_FAILURE),
- "Expected ERROR_NONE_MAPPED, got %d\n", GetLastError());
- ok(sid_size == 0, "Expected 0, got %d\n", sid_size);
- ok(domain_size == 0, "Expected 0, got %d\n", domain_size);
+ "Expected ERROR_NONE_MAPPED, got %d\n", GetLastError());
+ ok(sid_size == 0, "Expected 0, got %d\n", sid_size);
+ ok(domain_size == 0, "Expected 0, got %d\n", domain_size);
- }
- HeapFree(GetProcessHeap(), 0, psid);
- }
+ /* try an invalid system name */
+ SetLastError(0xdeadbeef);
+ sid_size = 0;
+ domain_size = 0;
+ ret = LookupAccountNameA("deepthought", NULL, NULL, &sid_size, NULL, &domain_size, &sid_use);
+ ok(!ret, "Expected 0, got %d\n", ret);
+ ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE || GetLastError() == RPC_S_INVALID_NET_ADDR /* Vista */,
+ "Expected RPC_S_SERVER_UNAVAILABLE or RPC_S_INVALID_NET_ADDR, got %d\n", GetLastError());
+ ok(sid_size == 0, "Expected 0, got %d\n", sid_size);
+ ok(domain_size == 0, "Expected 0, got %d\n", domain_size);
+
+ /* try with the computer name as the account name */
+ domain_size = sizeof(computer_name);
+ GetComputerNameA(computer_name, &domain_size);
+ sid_size = 0;
+ domain_size = 0;
+ ret = LookupAccountNameA(NULL, computer_name, NULL, &sid_size, NULL, &domain_size, &sid_use);
+ ok(!ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
+ GetLastError() == ERROR_NONE_MAPPED /* in a domain */ ||
+ broken(GetLastError() == ERROR_TRUSTED_DOMAIN_FAILURE) ||
+ broken(GetLastError() == ERROR_TRUSTED_RELATIONSHIP_FAILURE)),
+ "LookupAccountNameA failed: %d\n", GetLastError());
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ {
+ psid = HeapAlloc(GetProcessHeap(), 0, sid_size);
+ domain = HeapAlloc(GetProcessHeap(), 0, domain_size);
+ ret = LookupAccountNameA(NULL, computer_name, psid, &sid_size, domain, &domain_size, &sid_use);
+ ok(ret, "LookupAccountNameA failed: %d\n", GetLastError());
+ ok(sid_use == SidTypeDomain, "expected SidTypeDomain, got %d\n", sid_use);
+ HeapFree(GetProcessHeap(), 0, domain);
- HeapFree(GetProcessHeap(), 0, domain);
+ HeapFree(GetProcessHeap(), 0, psid);
++}
+
+ /* Well Known names */
+ if (!pCreateWellKnownSid)
+ {
+ win_skip("CreateWellKnownSid not available\n");
+ return;
+ }
+
+ if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH)
+ {
+ skip("Non-english locale (skipping well known name creation tests)\n");
+ return;
+ }
+
+ check_wellknown_name("LocalService", WinLocalServiceSid);
+ check_wellknown_name("Local Service", WinLocalServiceSid);
+ /* 2 spaces */
+ check_wellknown_name("Local Service", 0);
+ check_wellknown_name("NetworkService", WinNetworkServiceSid);
+ check_wellknown_name("Network Service", WinNetworkServiceSid);
+
+ /* example of some names where the spaces are not optional */
+ check_wellknown_name("Terminal Server User", WinTerminalServerSid);
+ check_wellknown_name("TerminalServer User", 0);
+ check_wellknown_name("TerminalServerUser", 0);
+ check_wellknown_name("Terminal ServerUser", 0);
+
+ check_wellknown_name("enterprise domain controllers",WinEnterpriseControllersSid);
+ check_wellknown_name("enterprisedomain controllers", 0);
+ check_wellknown_name("enterprise domaincontrollers", 0);
+ check_wellknown_name("enterprisedomaincontrollers", 0);
+
+ /* case insensitivity */
+ check_wellknown_name("lOCAlServICE", WinLocalServiceSid);
+
+ /* fully qualified account names */
+ check_wellknown_name("NT AUTHORITY\\LocalService", WinLocalServiceSid);
+ check_wellknown_name("nt authority\\Network Service", WinNetworkServiceSid);
+ check_wellknown_name("nt authority test\\Network Service", 0);
+ check_wellknown_name("Dummy\\Network Service", 0);
+ check_wellknown_name("ntauthority\\Network Service", 0);
}
static void test_security_descriptor(void)
status = pNtQueryObject( handle, ObjectBasicInformation, &obj_info,
sizeof(obj_info), NULL );
ok_(__FILE__, line)(!status, "NtQueryObject with err: %08x\n", status);
- ok_(__FILE__, line)(obj_info.GrantedAccess == access, "Granted access should "
- "be 0x%08x, instead of 0x%08x\n", access, obj_info.GrantedAccess);
+ if (alt)
+ ok_(__FILE__, line)(obj_info.GrantedAccess == access ||
+ obj_info.GrantedAccess == alt, "Granted access should be 0x%08x "
+ "or 0x%08x, instead of 0x%08x\n", access, alt, obj_info.GrantedAccess);
+ else
+ ok_(__FILE__, line)(obj_info.GrantedAccess == access, "Granted access should "
+ "be 0x%08x, instead of 0x%08x\n", access, obj_info.GrantedAccess);
}
#define CHECK_SET_SECURITY(o,i,e) \
ret = IsValidAcl(pAcl);
ok(ret, "IsValidAcl failed with error %d\n", GetLastError());
+ SetLastError(0xdeadbeef);
ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION4);
- ok(ret, "InitializeAcl(ACL_REVISION4) failed with error %d\n", GetLastError());
+ if (GetLastError() != ERROR_INVALID_PARAMETER)
+ {
+ ok(ret, "InitializeAcl(ACL_REVISION4) failed with error %d\n", GetLastError());
- ret = IsValidAcl(pAcl);
- ok(ret, "IsValidAcl failed with error %d\n", GetLastError());
+ ret = IsValidAcl(pAcl);
+ ok(ret, "IsValidAcl failed with error %d\n", GetLastError());
+ }
+ else
+ win_skip("ACL_REVISION4 is not implemented on NT4\n");
SetLastError(0xdeadbeef);
ret = InitializeAcl(pAcl, sizeof(buffer), -1);
/* create the INF file */
res = pAddDelBackupEntry("one\0two\0three\0", "c:\\", "basename", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
- ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
- ok(DeleteFileA(path), "Expected path to exist\n");
+ if (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES)
+ {
+ ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
+ ok(DeleteFileA(path), "Expected path to exist\n");
+ }
+ else
+ win_skip("Test file could not be created\n");
lstrcpyA(path, CURR_DIR);
lstrcatA(path, "\\backup\\basename.INI");
return 0;
}
- static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
+ static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
- BOOL fContinuation, void *pv)
+ BOOL fContinuation, void *pv)
{
return 0;
}
return FALSE;
}
- static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
+ static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
- USHORT *pattribs, int *err, void *pv)
+ USHORT *pattribs, int *err, void *pv)
{
BY_HANDLE_FILE_INFORMATION finfo;
FILETIME filetime;
return 0;
}
- static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
+ static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
- BOOL fContinuation, void *pv)
+ BOOL fContinuation, void *pv)
{
return 0;
}
return FALSE;
}
- static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
+ static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
- USHORT *pattribs, int *err, void *pv)
+ USHORT *pattribs, int *err, void *pv)
{
BY_HANDLE_FILE_INFORMATION finfo;
FILETIME filetime;
return 0;
}
- static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
+ static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
- BOOL fContinuation, void *pv)
+ BOOL fContinuation, void *pv)
{
return 0;
}
return FALSE;
}
- static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
+ static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
- USHORT *pattribs, int *err, void *pv)
+ USHORT *pattribs, int *err, void *pv)
{
BY_HANDLE_FILE_INFORMATION finfo;
FILETIME filetime;
FCIDestroy(hfci);
- hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
- fdi_write, fdi_close, fdi_seek,
- cpuUNKNOWN, &erf);
+ lstrcpyA(path, CURR_DIR);
+
+ /* path doesn't have a trailing backslash */
+ if (lstrlenA(path) > 2)
+ {
+ hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
+ fdi_write, fdi_close, fdi_seek,
+ cpuUNKNOWN, &erf);
- /* cabinet with no files or folders */
- SetLastError(0xdeadbeef);
- ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
- ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
- todo_wine
- {
- ok(GetLastError() == ERROR_INVALID_HANDLE,
- "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
- }
+ SetLastError(0xdeadbeef);
+ ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
+ ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
+ todo_wine
+ {
+ ok(GetLastError() == ERROR_INVALID_HANDLE,
+ "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+ }
- FDIDestroy(hfdi);
+ FDIDestroy(hfdi);
+ }
+ else
+ skip("Running on a root drive directory.\n");
+
+ lstrcatA(path, "\\");
+
+ hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
+ fdi_write, fdi_close, fdi_seek,
+ cpuUNKNOWN, &erf);
+
+ /* cabinet with no files or folders */
+ SetLastError(0xdeadbeef);
+ ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
+ todo_wine
+ ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+ ok(GetLastError() == 0, "Expected 0f, got %d\n", GetLastError());
+
+ FDIDestroy(hfdi);
+
DeleteFileA(name);
}
#include "wine/test.h"
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x \n", hr)
- static void register_testentry(void)
+ static BOOL register_testentry(void)
{
- HKEY hkey,hkey2;
+ HKEY hkey = 0, hkey2 = 0;
+ DWORD ret;
- RegCreateKeyA(HKEY_CLASSES_ROOT,"CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}",
- &hkey);
- RegSetValueA(hkey,NULL,REG_SZ,"ComCat Test key",16);
- RegCreateKeyA(hkey,
+ ret = RegCreateKeyA(HKEY_CLASSES_ROOT,"CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}", &hkey);
+ if (!ret) ret = RegSetValueA(hkey,NULL,REG_SZ,"ComCat Test key",16);
+ if (!ret) ret = RegCreateKeyA(hkey,
- "Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}",
- &hkey2);
+ "Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}",
+ &hkey2);
-
RegCloseKey(hkey);
RegCloseKey(hkey2);
+ return !ret;
}
static void unregister_testentry(void)
IEnumCLSID *pIEnum =(IEnumCLSID*)0xdeadcafe;
- CLSIDFromString((LPOLESTR)szCatID,the_cat);
- CLSIDFromString((LPOLESTR)szGuid,&wanted_guid);
+ CLSIDFromString(szCatID,the_cat);
+ CLSIDFromString(szGuid,&wanted_guid);
-
+
OleInitialize(NULL);
hr = CoCreateInstance(rclsid,NULL,CLSCTX_INPROC_SERVER,
hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
ok (fetched == 0,"Fetched wrong number of guids %u\n",fetched);
IEnumGUID_Release(pIEnum);
-
+
- register_testentry();
- hr = ICatInformation_EnumClassesOfCategories(pICat, 1, the_cat, -1, NULL,
- &pIEnum);
+ if (register_testentry())
+ {
+ hr = ICatInformation_EnumClassesOfCategories(pICat, 1, the_cat, -1, NULL, &pIEnum);
- ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
+ ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
- hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
- ok (fetched == 1,"Fetched wrong number of guids %u\n",fetched);
- ok (IsEqualGUID(the_guid,&wanted_guid),"Guids do not match\n");
+ hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
+ ok (fetched == 1,"Fetched wrong number of guids %u\n",fetched);
+ ok (IsEqualGUID(the_guid,&wanted_guid),"Guids do not match\n");
- IEnumGUID_Release(pIEnum);
- unregister_testentry();
+ IEnumGUID_Release(pIEnum);
- ICatInformation_Release(pICat);
+ unregister_testentry();
+ }
+ else skip( "Could not register the test category\n" );
+
+ ICatInformation_Release(pICat);
OleUninitialize();
}
hChild = create_custom_header_control(hParent, TRUE);
assert(hChild);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
- "adder header control to parent", TRUE);
+ "adder header control to parent", FALSE);
+
+ timeout = SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100);
+ SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, timeout);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
- todo_wine
- {
+
- /* msdn incorrectly states that return value
- * is the index of the filter control being
- * modified. The sendMessage here should
- * return previous filter timeout value
+ /* msdn incorrectly states that return value
+ * is the index of the filter control being
+ * modified. The sendMessage here should
+ * return previous filter timeout value
*/
- retVal = SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100);
+
- expect(1000, retVal);
+ retVal = SendMessage(hChild, HDM_SETFILTERCHANGETIMEOUT, 1, 100);
+ expect(timeout, retVal);
+
+ todo_wine
+ {
retVal = SendMessage(hChild, HDM_CLEARFILTER, 0, 1);
expect(1, retVal);
retVal = SendMessage(hChild, HDM_EDITFILTER, 1, 0);
#include "wine/test.h"
#include "msg.h"
-#define PARENT_SEQ_INDEX 0
+#define PARENT_SEQ_INDEX 0
- #define LISTVIEW_SEQ_INDEX 1
- #define NUM_MSG_SEQUENCES 2
+ #define PARENT_FULL_SEQ_INDEX 1
+ #define LISTVIEW_SEQ_INDEX 2
+ #define NUM_MSG_SEQUENCES 3
#define LISTVIEW_ID 0
#define HEADER_ID 1
SetKeyboardState(kstate);
}
DestroyWindow(hwnd);
- }
+
+ /* make multiple selection, then switch to LVS_SINGLESEL */
+ hwnd = create_listview_control(0);
+ for (i=0;i<items;i++) {
+ insert_item(hwnd, 0);
++}
+ item_count = (int)SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0);
+ expect(items,item_count);
+ /* deselect all items */
+ ListView_SetItemState(hwnd, -1, 0, LVIS_SELECTED);
+ SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, -1);
+ for (i=0;i<3;i++) {
+ ListView_SetItemState(hwnd, i, LVIS_SELECTED, LVIS_SELECTED);
+ }
+
+ r = SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(3, r);
+ r = SendMessage(hwnd, LVM_GETSELECTIONMARK, 0, 0);
+ todo_wine
+ expect(-1, r);
+
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(!(style & LVS_SINGLESEL), "LVS_SINGLESEL isn't expected\n");
+ SetWindowLongPtrA(hwnd, GWL_STYLE, style | LVS_SINGLESEL);
+ /* check that style is accepted */
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(style & LVS_SINGLESEL, "LVS_SINGLESEL expected\n");
+
+ for (i=0;i<3;i++) {
+ r = ListView_GetItemState(hwnd, i, LVIS_SELECTED);
+ ok(r & LVIS_SELECTED, "Expected item %d to be selected\n", i);
+ }
+ r = SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(3, r);
+ SendMessage(hwnd, LVM_GETSELECTIONMARK, 0, 0);
+ expect(3, r);
+
+ /* select one more */
+ ListView_SetItemState(hwnd, 3, LVIS_SELECTED, LVIS_SELECTED);
+
+ for (i=0;i<3;i++) {
+ r = ListView_GetItemState(hwnd, i, LVIS_SELECTED);
+ ok(!(r & LVIS_SELECTED), "Expected item %d to be unselected\n", i);
+ }
+ r = ListView_GetItemState(hwnd, 3, LVIS_SELECTED);
+ ok(r & LVIS_SELECTED, "Expected item %d to be selected\n", i);
+
+ r = SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(1, r);
+ r = SendMessage(hwnd, LVM_GETSELECTIONMARK, 0, 0);
+ todo_wine
+ expect(-1, r);
+
+ DestroyWindow(hwnd);
+ }
+
+ static void test_subitem_rect(void)
+ {
+ HWND hwnd;
+ DWORD r;
+ LVCOLUMN col;
+ RECT rect;
+
+ /* test LVM_GETSUBITEMRECT for header */
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ /* add some columns */
+ memset(&col, 0, sizeof(LVCOLUMN));
+ col.mask = LVCF_WIDTH;
+ col.cx = 100;
+ r = -1;
+ r = SendMessage(hwnd, LVM_INSERTCOLUMN, 0, (LPARAM)&col);
+ expect(0, r);
+ col.cx = 150;
+ r = -1;
+ r = SendMessage(hwnd, LVM_INSERTCOLUMN, 1, (LPARAM)&col);
+ expect(1, r);
+ col.cx = 200;
+ r = -1;
+ r = SendMessage(hwnd, LVM_INSERTCOLUMN, 2, (LPARAM)&col);
+ expect(2, r);
+ /* item = -1 means header, subitem index is 1 based */
+ rect.left = LVIR_BOUNDS;
+ rect.top = 0;
+ rect.right = rect.bottom = 0;
+ r = SendMessage(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
+ expect(0, r);
+
+ rect.left = LVIR_BOUNDS;
+ rect.top = 1;
+ rect.right = rect.bottom = 0;
+ r = SendMessage(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
+
+ ok(r != 0, "Expected not-null LRESULT\n");
+ expect(100, rect.left);
+ expect(250, rect.right);
+ todo_wine
+ expect(3, rect.top);
+
+ rect.left = LVIR_BOUNDS;
+ rect.top = 2;
+ rect.right = rect.bottom = 0;
+ r = SendMessage(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
+
+ ok(r != 0, "Expected not-null LRESULT\n");
+ expect(250, rect.left);
+ expect(450, rect.right);
+ todo_wine
+ expect(3, rect.top);
+
+ DestroyWindow(hwnd);
+
+ /* try it for non LVS_REPORT style */
+ hwnd = CreateWindow("SysListView32", "Test", LVS_ICON, 0, 0, 100, 100, NULL, NULL,
+ GetModuleHandle(NULL), 0);
+ rect.left = LVIR_BOUNDS;
+ rect.top = 1;
+ rect.right = rect.bottom = -10;
+ r = SendMessage(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
+ ok(r == 0, "Expected not-null LRESULT\n");
+ /* rect is unchanged */
+ expect(0, rect.left);
+ expect(-10, rect.right);
+ expect(1, rect.top);
+ expect(-10, rect.bottom);
+ DestroyWindow(hwnd);
+ }
+
+ /* comparison callback for test_sorting */
+ static INT WINAPI test_CallBackCompare(LPARAM first, LPARAM second, LPARAM lParam)
+ {
+ if (first == second) return 0;
+ return (first > second ? 1 : -1);
+ }
+
+ static void test_sorting(void)
+ {
+ HWND hwnd;
+ LVITEMA item = {0};
+ DWORD r;
+ LONG_PTR style;
+ static CHAR names[][5] = {"A", "B", "C", "D", "0"};
+ CHAR buff[10];
+
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+
+ /* insert some items */
+ item.mask = LVIF_PARAM | LVIF_STATE;
+ item.state = LVIS_SELECTED;
+ item.iItem = 0;
+ item.iSubItem = 0;
+ item.lParam = 3;
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(0, r);
+
+ item.mask = LVIF_PARAM;
+ item.iItem = 1;
+ item.iSubItem = 0;
+ item.lParam = 2;
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(1, r);
+
+ item.mask = LVIF_STATE | LVIF_PARAM;
+ item.state = LVIS_SELECTED;
+ item.iItem = 2;
+ item.iSubItem = 0;
+ item.lParam = 4;
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(2, r);
+
+ r = SendMessage(hwnd, LVM_GETSELECTIONMARK, 0, 0);
+ expect(-1, r);
+
+ r = SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(2, r);
+
+ r = SendMessage(hwnd, LVM_SORTITEMS, 0, (LPARAM)test_CallBackCompare);
+ expect(TRUE, r);
+
+ r = SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(2, r);
+ r = SendMessage(hwnd, LVM_GETSELECTIONMARK, 0, 0);
+ expect(-1, r);
+ r = SendMessage(hwnd, LVM_GETITEMSTATE, 0, LVIS_SELECTED);
+ expect(0, r);
+ r = SendMessage(hwnd, LVM_GETITEMSTATE, 1, LVIS_SELECTED);
+ expect(LVIS_SELECTED, r);
+ r = SendMessage(hwnd, LVM_GETITEMSTATE, 2, LVIS_SELECTED);
+ expect(LVIS_SELECTED, r);
+
+ DestroyWindow(hwnd);
+
+ /* switch to LVS_SORTASCENDING when some items added */
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+
+ item.mask = LVIF_TEXT;
+ item.iItem = 0;
+ item.iSubItem = 0;
+ item.pszText = names[1];
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(0, r);
+
+ item.mask = LVIF_TEXT;
+ item.iItem = 1;
+ item.iSubItem = 0;
+ item.pszText = names[2];
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(1, r);
+
+ item.mask = LVIF_TEXT;
+ item.iItem = 2;
+ item.iSubItem = 0;
+ item.pszText = names[0];
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(2, r);
+
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ SetWindowLongPtrA(hwnd, GWL_STYLE, style | LVS_SORTASCENDING);
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
+
+ /* no sorting performed when switched to LVS_SORTASCENDING */
+ item.mask = LVIF_TEXT;
+ item.iItem = 0;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff);
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
+
+ item.iItem = 1;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
+
+ item.iItem = 2;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
+
+ /* adding new item doesn't resort list */
+ item.mask = LVIF_TEXT;
+ item.iItem = 3;
+ item.iSubItem = 0;
+ item.pszText = names[3];
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(3, r);
+
+ item.mask = LVIF_TEXT;
+ item.iItem = 0;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff);
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
+
+ item.iItem = 1;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
+
+ item.iItem = 2;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
+
+ item.iItem = 3;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[3]) == 0, "Expected '%s', got '%s'\n", names[3], buff);
+
+ /* corner case - item should be placed at first position */
+ item.mask = LVIF_TEXT;
+ item.iItem = 4;
+ item.iSubItem = 0;
+ item.pszText = names[4];
+ r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
+ expect(0, r);
+
+ item.iItem = 0;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff);
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[4]) == 0, "Expected '%s', got '%s'\n", names[4], buff);
+
+ item.iItem = 1;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff);
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
+
+ item.iItem = 2;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
+
+ item.iItem = 3;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
+
+ item.iItem = 4;
+ r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
+ expect(TRUE, r);
+ ok(lstrcmp(buff, names[3]) == 0, "Expected '%s', got '%s'\n", names[3], buff);
+
+ DestroyWindow(hwnd);
+ }
+
+ static void test_ownerdata(void)
+ {
+ HWND hwnd;
+ LONG_PTR style, ret;
+ DWORD res;
+ LVITEMA item;
+
+ /* it isn't possible to set LVS_OWNERDATA after creation */
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(!(style & LVS_OWNERDATA) && style, "LVS_OWNERDATA isn't expected\n");
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ ret = SetWindowLongPtrA(hwnd, GWL_STYLE, style | LVS_OWNERDATA);
+ ok(ret == style, "Expected set GWL_STYLE to succeed\n");
+ ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_ownerdata_switchto_seq,
+ "try to switch to LVS_OWNERDATA seq", FALSE);
+
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(!(style & LVS_OWNERDATA), "LVS_OWNERDATA isn't expected\n");
+ DestroyWindow(hwnd);
+
+ /* try to set LVS_OWNERDATA after creation just having it */
+ hwnd = create_listview_control(LVS_OWNERDATA);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ ret = SetWindowLongPtrA(hwnd, GWL_STYLE, style | LVS_OWNERDATA);
+ ok(ret == style, "Expected set GWL_STYLE to succeed\n");
+ ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_ownerdata_switchto_seq,
+ "try to switch to LVS_OWNERDATA seq", FALSE);
+ DestroyWindow(hwnd);
+
+ /* try to remove LVS_OWNERDATA after creation just having it */
+ hwnd = create_listview_control(LVS_OWNERDATA);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ ret = SetWindowLongPtrA(hwnd, GWL_STYLE, style & ~LVS_OWNERDATA);
+ ok(ret == style, "Expected set GWL_STYLE to succeed\n");
+ ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_ownerdata_switchto_seq,
+ "try to switch to LVS_OWNERDATA seq", FALSE);
+ style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+ ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
+ DestroyWindow(hwnd);
+
+ /* try select an item */
+ hwnd = create_listview_control(LVS_OWNERDATA);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0);
+ ok(res != 0, "Expected LVM_SETITEMCOUNT to succeed\n");
+ res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(0, res);
+ memset(&item, 0, sizeof(item));
+ item.stateMask = LVIS_SELECTED;
+ item.state = LVIS_SELECTED;
+ res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item);
+ expect(TRUE, res);
+ res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
+ expect(1, res);
+ res = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
+ expect(1, res);
+ DestroyWindow(hwnd);
+
+ /* LVM_SETITEM is unsupported on LVS_OWNERDATA */
+ hwnd = create_listview_control(LVS_OWNERDATA);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0);
+ ok(res != 0, "Expected LVM_SETITEMCOUNT to succeed\n");
+ res = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
+ expect(1, res);
+ memset(&item, 0, sizeof(item));
+ item.mask = LVIF_STATE;
+ item.iItem = 0;
+ item.stateMask = LVIS_SELECTED;
+ item.state = LVIS_SELECTED;
+ res = SendMessageA(hwnd, LVM_SETITEM, 0, (LPARAM)&item);
+ expect(FALSE, res);
+ DestroyWindow(hwnd);
+ }
+
+ static void test_norecompute(void)
+ {
+ static CHAR testA[] = "test";
+ CHAR buff[10];
+ LVITEMA item;
+ HWND hwnd;
+ DWORD res;
+
+ /* self containing control */
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ memset(&item, 0, sizeof(item));
+ item.mask = LVIF_TEXT | LVIF_STATE;
+ item.iItem = 0;
+ item.stateMask = LVIS_SELECTED;
+ item.state = LVIS_SELECTED;
+ item.pszText = testA;
+ res = SendMessageA(hwnd, LVM_INSERTITEM, 0, (LPARAM)&item);
+ expect(0, res);
+ /* retrieve with LVIF_NORECOMPUTE */
+ item.mask = LVIF_TEXT | LVIF_NORECOMPUTE;
+ item.iItem = 0;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff)/sizeof(CHAR);
+ res = SendMessageA(hwnd, LVM_GETITEM, 0, (LPARAM)&item);
+ expect(TRUE, res);
+ ok(lstrcmp(buff, testA) == 0, "Expected (%s), got (%s)\n", testA, buff);
+
+ item.mask = LVIF_TEXT;
+ item.iItem = 1;
+ item.pszText = LPSTR_TEXTCALLBACK;
+ res = SendMessageA(hwnd, LVM_INSERTITEM, 0, (LPARAM)&item);
+ expect(1, res);
+
+ item.mask = LVIF_TEXT | LVIF_NORECOMPUTE;
+ item.iItem = 1;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff)/sizeof(CHAR);
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ res = SendMessageA(hwnd, LVM_GETITEM, 0, (LPARAM)&item);
+ expect(TRUE, res);
+ ok(item.pszText == LPSTR_TEXTCALLBACK, "Expected (%p), got (%p)\n",
+ LPSTR_TEXTCALLBACK, (VOID*)item.pszText);
+ ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq", FALSE);
+
+ DestroyWindow(hwnd);
+
+ /* LVS_OWNERDATA */
+ hwnd = create_listview_control(LVS_OWNERDATA);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+
+ item.mask = LVIF_STATE;
+ item.stateMask = LVIS_SELECTED;
+ item.state = LVIS_SELECTED;
+ item.iItem = 0;
+ res = SendMessageA(hwnd, LVM_INSERTITEM, 0, (LPARAM)&item);
+ expect(0, res);
+
+ item.mask = LVIF_TEXT | LVIF_NORECOMPUTE;
+ item.iItem = 0;
+ item.pszText = buff;
+ item.cchTextMax = sizeof(buff)/sizeof(CHAR);
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ res = SendMessageA(hwnd, LVM_GETITEM, 0, (LPARAM)&item);
+ expect(TRUE, res);
+ ok(item.pszText == LPSTR_TEXTCALLBACK, "Expected (%p), got (%p)\n",
+ LPSTR_TEXTCALLBACK, (VOID*)item.pszText);
+ ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq 2", FALSE);
+
+ DestroyWindow(hwnd);
+ }
+
+ static void test_nosortheader(void)
+ {
+ HWND hwnd, header;
+ LONG_PTR style;
+
+ hwnd = create_listview_control(0);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+
+ header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(header), "header expected\n");
+
+ style = GetWindowLongPtr(header, GWL_STYLE);
+ ok(style & HDS_BUTTONS, "expected header to have HDS_BUTTONS\n");
+
+ style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ SetWindowLongPtr(hwnd, GWL_STYLE, style | LVS_NOSORTHEADER);
+ /* HDS_BUTTONS retained */
+ style = GetWindowLongPtr(header, GWL_STYLE);
+ ok(style & HDS_BUTTONS, "expected header to retain HDS_BUTTONS\n");
+
+ DestroyWindow(hwnd);
+
+ /* create with LVS_NOSORTHEADER */
+ hwnd = create_listview_control(LVS_NOSORTHEADER);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+
+ header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(header), "header expected\n");
+
+ style = GetWindowLongPtr(header, GWL_STYLE);
+ ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
+
+ style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ SetWindowLongPtr(hwnd, GWL_STYLE, style & ~LVS_NOSORTHEADER);
+ /* not changed here */
+ style = GetWindowLongPtr(header, GWL_STYLE);
+ ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
+
+ DestroyWindow(hwnd);
}
START_TEST(listview)
todo_wine {expect(MCHT_TODAYLINK, res);}
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE);
- }
+
+ /* The horizontal position of title bar elements depends on locale (y pos
+ is constant), so we sample across a horizontal line and make sure we
+ find all elements. */
+ mchit.pt.y = 40;
+ title_index = 0;
+ for (x = 0; x < 300; x++){
+ mchit.pt.x = x;
+ res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
+ expect(x, mchit.pt.x);
+ expect(40, mchit.pt.y);
+ expect(mchit.uHit, res);
+ if (res != title_hits[title_index]){
+ title_index++;
+ if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index)
+ break;
+ todo_wine {expect(title_hits[title_index], res);}
++}
+ }
+ todo_wine {ok(300 <= x && title_index + 1 == sizeof(title_hits) / sizeof(title_hits[0]),
+ "Wrong title layout\n");}
}
static void test_monthcal_todaylink(HWND hwnd)
expect(11,LOWORD(r));
expect(0,HIWORD(r));
r = SendMessage(hWndStatus, SB_GETTEXT, 1, (LPARAM) charArray);
- todo_wine
- {
- ok(strcmp(charArray,"InvalidChars\\7 ") == 0, "Expected InvalidChars\\7 , got %s\n", charArray);
- }
- expect(15,LOWORD(r));
+ ok(strcmp(charArray,"Invalid\tChars\\7 ") == 0, "Expected Invalid\tChars\\7 , got %s\n", charArray);
+
+ expect(16,LOWORD(r));
expect(0,HIWORD(r));
r = SendMessage(hWndStatus, SB_GETTEXT, 2, (LPARAM) charArray);
- todo_wine
- {
- ok(strcmp(charArray,"InvalidChars\\n ") == 0, "Expected InvalidChars\\n , got %s\n", charArray);
+ ok(strcmp(charArray,"InvalidChars\\n ") == 0, "Expected InvalidChars\\n , got %s\n", charArray);
- }
+
expect(15,LOWORD(r));
expect(0,HIWORD(r));
/* Testing Flat Separators */
extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_FLATSEPARATORS);
- expect(extendedStyle, prevExtendedStyle);
+ expect(extendedStyle, prevExtendedStyle);
extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
- todo_wine{
- expect(TCS_EX_FLATSEPARATORS, extendedStyle);
+ expect(TCS_EX_FLATSEPARATORS, extendedStyle);
- }
/* Testing Register Drop */
prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_REGISTERDROP);
/* test TBM_GETPAGESIZE */
r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0,0);
- todo_wine{
- expect(20, r);
+ expect(20, r);
- }
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, page_size_test_seq, "page size test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent page size test sequence", FALSE);
/* test TBM_GETTICPIC */
r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 0, 0);
- todo_wine{
- ok(r > 0, "Expected r > 0, got %d\n", r);
+ ok(r > 0, "Expected r > 0, got %d\n", r);
- r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 4, 0);
+ r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 2, 0);
- ok(r > 0, "Expected r > 0, got %d\n", r);
+ ok(r > 0, "Expected r > 0, got %d\n", r);
- }
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_placement_test_seq, "get tic placement test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent get tic placement test sequence", FALSE);
{
COLORREF crColor = RGB(0,0,0);
- todo_wine{
- /* If the value is -1, the control is using the system color for the background color. */
- crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 );
- ok(crColor == -1, "Default background color reported as 0x%.8x\n", crColor);
+ /* If the value is -1, the control is using the system color for the background color. */
+ crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 );
+ ok(crColor == -1, "Default background color reported as 0x%.8x\n", crColor);
- }
/* Test for black background */
SendMessage( hTree, TVM_SETBKCOLOR, 0, (LPARAM)RGB(0,0,0) );
IdentifyItem(pTreeView->itemOld.hItem);
IdentifyItem(pTreeView->itemNew.hItem);
return 0;
- }
+ case TVN_GETDISPINFOA: {
+ NMTVDISPINFOA *disp = (NMTVDISPINFOA *)lParam;
+ if (disp->item.mask & TVIF_TEXT) {
+ lstrcpyn(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax);
- }
++ }
+ return 0;
++ }
}
}
return 0;
ok(ret == 0, "%d != 0\n", ret);
ret = GetObject(hbm, 1, &bm);
- ok(ret == 0, "%d != 0\n", ret);
+ ok(ret == 0 || broken(ret == 1 /* Win9x */), "%d != 0\n", ret);
+
+ /* Don't trust Win9x not to try to write to NULL */
+ if (ret == 0)
+ {
+ ret = GetObject(hbm, 0, NULL);
+ ok(ret == sizeof(bm), "wrong size %d\n", ret);
- }
++}
}
static void test_createdibitmap(void)
bmih.biPlanes = 1;
bmih.biBitCount = 32;
bmih.biCompression = BI_RGB;
-
+
+ hbm = CreateDIBitmap(hdc, NULL, CBM_INIT, NULL, NULL, 0);
+ ok(hbm == NULL, "CreateDIBitmap should fail\n");
+ hbm = CreateDIBitmap(hdc, NULL, 0, NULL, NULL, 0);
+ ok(hbm == NULL, "CreateDIBitmap should fail\n");
+
/* First create an un-initialised bitmap. The depth of the bitmap
should match that of the hdc and not that supplied in bmih.
*/
SetLastError(0xdeadbeef);
hbmp = CreateBitmap(0x7ffffff + 1, 1, 1, 1, NULL);
- ok(!hbmp, "CreateBitmap should fail\n");
+ ok(!hbmp || broken(hbmp != NULL /* Win9x */), "CreateBitmap should fail\n");
+ if (!hbmp)
- ok(GetLastError() == ERROR_INVALID_PARAMETER,
- "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+ else
+ DeleteObject(hbmp);
hbmp = CreateBitmap(15, 15, 1, 1, NULL);
assert(hbmp != NULL);
break;
}
}
- if (bpp != 1)
- ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
+ ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
- else
- todo_wine ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
HeapFree(GetProcessHeap(), 0, bits2);
DeleteDC(dc);
memset(dibinfo, 0, sizeof(dibinfo_buf));
dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
ret = GetDIBits(hdc, hbm, 0, 0, bits, dibinfo, DIB_RGB_COLORS);
+ if (ret == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
+ win_skip("Win9x/WinMe doesn't handle 0 for the number of scan lines\n");
+ else
+ {
+ ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
- ok( !bitmasks[0], "red mask is set\n" );
- ok( !bitmasks[1], "green mask is set\n" );
- ok( !bitmasks[2], "blue mask is set\n" );
- ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
+ ok( !bitmasks[0], "red mask is set\n" );
+ ok( !bitmasks[1], "green mask is set\n" );
+ ok( !bitmasks[2], "blue mask is set\n" );
+ ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
- memset(bitmasks, 0, 3*sizeof(DWORD));
- dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
- ret = GetDIBits(hdc, hbm, 0, 0, bits, dibinfo, DIB_RGB_COLORS);
- ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
+ memset(bitmasks, 0, 3*sizeof(DWORD));
+ dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
+ ret = GetDIBits(hdc, hbm, 0, 0, bits, dibinfo, DIB_RGB_COLORS);
+ ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
- ok( bitmasks[0] != 0, "red mask is not set\n" );
- ok( bitmasks[1] != 0, "green mask is not set\n" );
- ok( bitmasks[2] != 0, "blue mask is not set\n" );
- ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
- }
+ ok( bitmasks[0] != 0, "red mask is not set\n" );
+ ok( bitmasks[1] != 0, "green mask is not set\n" );
+ ok( bitmasks[2] != 0, "blue mask is not set\n" );
+ ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
+ }
+ }
else skip("not in 16 bpp BI_BITFIELDS mode, skipping that test\n");
DeleteObject(hbm);
SetLastError(0xdeadbeef);
hrgn = ExtCreateRegion(NULL, 1, &rgn.data);
- ok(hrgn != 0, "ExtCreateRegion error %u\n", GetLastError());
+ ok(hrgn != 0 ||
+ broken(GetLastError() == 0xdeadbeef), /* NT4 */
+ "ExtCreateRegion error %u\n", GetLastError());
+ if(hrgn)
+ {
- verify_region(hrgn, &rc);
- DeleteObject(hrgn);
+ verify_region(hrgn, &rc);
+ DeleteObject(hrgn);
+ }
xform.eM11 = 0.5; /* 50% width */
xform.eM12 = 0.0;
hfont = create_font("fractional", &bitmap_lf);
scale = (i + height_orig - 1) / height_orig;
nearest_height = scale * height_orig;
- /* XP allows not more than 10% deviation */
- if (scale > 1 && nearest_height - i > nearest_height / 10) scale--;
+ /* Only jump to the next height if the difference <= 25% original height */
+ if (scale > 2 && nearest_height - i > height_orig / 4) scale--;
+ /* The jump between unscaled and doubled is delayed by 1 in winnt+ but not in win9x,
+ so we'll not test this particular height. */
+ else if(scale == 2 && nearest_height - i == (height_orig / 4)) continue;
+ else if(scale == 2 && nearest_height - i > (height_orig / 4 - 1)) scale--;
+ old_hfont = SelectObject(hdc, hfont);
test_font_metrics(hdc, hfont, bitmap_lf.lfHeight, 0, test_str, sizeof(test_str), &tm_orig, &size_orig, width_orig, 1, scale);
- DeleteObject(hfont);
+ SelectObject(hdc, old_hfont);
+ DeleteObject(hfont);
}
/* test integer scaling 3x2 */
hfont = create_font(lf.lfFaceName, &lf);
old_hfont = SelectObject(hdc, hfont);
ok(GetTextMetrics(hdc, &tm), "GetTextMetrics error %d\n", GetLastError());
-
+ if(fd[i].dpi == tm.tmDigitizedAspectX)
+ {
+ trace("found font %s, height %d charset %x dpi %d\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
- ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != %d\n", fd[i].face_name, fd[i].height, tm.tmWeight, fd[i].weight);
- ok(tm.tmHeight == fd[i].height, "%s(%d): tm.tmHeight %d != %d\n", fd[i].face_name, fd[i].height, tm.tmHeight, fd[i].height);
- ok(tm.tmAscent == fd[i].ascent, "%s(%d): tm.tmAscent %d != %d\n", fd[i].face_name, fd[i].height, tm.tmAscent, fd[i].ascent);
- ok(tm.tmDescent == fd[i].descent, "%s(%d): tm.tmDescent %d != %d\n", fd[i].face_name, fd[i].height, tm.tmDescent, fd[i].descent);
- ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): tm.tmInternalLeading %d != %d\n", fd[i].face_name, fd[i].height, tm.tmInternalLeading, fd[i].int_leading);
- ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %d != %d\n", fd[i].face_name, fd[i].height, tm.tmExternalLeading, fd[i].ext_leading);
- ok(tm.tmAveCharWidth == fd[i].ave_char_width, "%s(%d): tm.tmAveCharWidth %d != %d\n", fd[i].face_name, fd[i].height, tm.tmAveCharWidth, fd[i].ave_char_width);
-
- /* Don't run the max char width test on System/ANSI_CHARSET. We have extra characters in our font
- that make the max width bigger */
- if(strcmp(lf.lfFaceName, "System") || lf.lfCharSet != ANSI_CHARSET)
- ok(tm.tmMaxCharWidth == fd[i].max_char_width, "%s(%d): tm.tmMaxCharWidth %d != %d\n", fd[i].face_name, fd[i].height, tm.tmMaxCharWidth, fd[i].max_char_width);
+ ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != %d\n", fd[i].face_name, fd[i].height, tm.tmWeight, fd[i].weight);
+ ok(tm.tmHeight == fd[i].height, "%s(%d): tm.tmHeight %d != %d\n", fd[i].face_name, fd[i].height, tm.tmHeight, fd[i].height);
+ ok(tm.tmAscent == fd[i].ascent, "%s(%d): tm.tmAscent %d != %d\n", fd[i].face_name, fd[i].height, tm.tmAscent, fd[i].ascent);
+ ok(tm.tmDescent == fd[i].descent, "%s(%d): tm.tmDescent %d != %d\n", fd[i].face_name, fd[i].height, tm.tmDescent, fd[i].descent);
+ ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): tm.tmInternalLeading %d != %d\n", fd[i].face_name, fd[i].height, tm.tmInternalLeading, fd[i].int_leading);
+ ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %d != %d\n", fd[i].face_name, fd[i].height, tm.tmExternalLeading, fd[i].ext_leading);
+ ok(tm.tmAveCharWidth == fd[i].ave_char_width, "%s(%d): tm.tmAveCharWidth %d != %d\n", fd[i].face_name, fd[i].height, tm.tmAveCharWidth, fd[i].ave_char_width);
+
+ /* Don't run the max char width test on System/ANSI_CHARSET. We have extra characters in our font
+ that make the max width bigger */
+ if(strcmp(lf.lfFaceName, "System") || lf.lfCharSet != ANSI_CHARSET)
+ ok(tm.tmMaxCharWidth == fd[i].max_char_width, "%s(%d): tm.tmMaxCharWidth %d != %d\n", fd[i].face_name, fd[i].height, tm.tmMaxCharWidth, fd[i].max_char_width);
-
+ }
SelectObject(hdc, old_hfont);
DeleteObject(hfont);
}
*/
if (!*font_name && font_charset == DEFAULT_CHARSET) /* do it only once */
{
- efd.total = 0;
+ /*
+ * Use EnumFontFamiliesW since win98 crashes when the
+ * second parameter is NULL using EnumFontFamilies
+ */
+ efdw.total = 0;
SetLastError(0xdeadbeef);
- ret = EnumFontFamilies(hdc, NULL, arial_enum_proc, (LPARAM)&efd);
- ok(ret, "EnumFontFamilies error %u\n", GetLastError());
- get_charset_stats(&efd, &ansi_charset, &symbol_charset, &russian_charset);
+ ret = EnumFontFamiliesW(hdc, NULL, arial_enum_procw, (LPARAM)&efdw);
+ ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "EnumFontFamiliesW error %u\n", GetLastError());
+ if(ret)
+ {
+ get_charset_statsW(&efdw, &ansi_charset, &symbol_charset, &russian_charset);
- trace("enumerated ansi %d, symbol %d, russian %d fonts for NULL\n",
- ansi_charset, symbol_charset, russian_charset);
+ trace("enumerated ansi %d, symbol %d, russian %d fonts for NULL\n",
+ ansi_charset, symbol_charset, russian_charset);
- ok(efd.total > 0, "no fonts enumerated: NULL\n");
+ ok(efdw.total > 0, "fonts enumerated: NULL\n");
- ok(ansi_charset > 0, "NULL family should enumerate ANSI_CHARSET\n");
- ok(symbol_charset > 0, "NULL family should enumerate SYMBOL_CHARSET\n");
+ ok(ansi_charset > 0, "NULL family should enumerate ANSI_CHARSET\n");
+ ok(symbol_charset > 0, "NULL family should enumerate SYMBOL_CHARSET\n");
- ok(russian_charset > 0, "NULL family should enumerate RUSSIAN_CHARSET\n");
+ ok(russian_charset > 0 ||
+ broken(russian_charset == 0), /* NT4 */
+ "NULL family should enumerate RUSSIAN_CHARSET\n");
+ }
- efd.total = 0;
+ efdw.total = 0;
SetLastError(0xdeadbeef);
- ret = EnumFontFamiliesEx(hdc, NULL, arial_enum_proc, (LPARAM)&efd, 0);
- ok(ret, "EnumFontFamiliesEx error %u\n", GetLastError());
- get_charset_stats(&efd, &ansi_charset, &symbol_charset, &russian_charset);
+ ret = EnumFontFamiliesExW(hdc, NULL, arial_enum_procw, (LPARAM)&efdw, 0);
+ ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "EnumFontFamiliesExW error %u\n", GetLastError());
+ if(ret)
+ {
+ get_charset_statsW(&efdw, &ansi_charset, &symbol_charset, &russian_charset);
- trace("enumerated ansi %d, symbol %d, russian %d fonts for NULL\n",
- ansi_charset, symbol_charset, russian_charset);
+ trace("enumerated ansi %d, symbol %d, russian %d fonts for NULL\n",
+ ansi_charset, symbol_charset, russian_charset);
- ok(efd.total > 0, "no fonts enumerated: NULL\n");
+ ok(efdw.total > 0, "fonts enumerated: NULL\n");
- ok(ansi_charset > 0, "NULL family should enumerate ANSI_CHARSET\n");
- ok(symbol_charset > 0, "NULL family should enumerate SYMBOL_CHARSET\n");
- ok(russian_charset > 0, "NULL family should enumerate RUSSIAN_CHARSET\n");
- }
+ ok(ansi_charset > 0, "NULL family should enumerate ANSI_CHARSET\n");
+ ok(symbol_charset > 0, "NULL family should enumerate SYMBOL_CHARSET\n");
+ ok(russian_charset > 0, "NULL family should enumerate RUSSIAN_CHARSET\n");
+ }
+ }
efd.total = 0;
SetLastError(0xdeadbeef);
ret = GetFontData(hdc, MS_OS2_TAG, 0, &tt_os2, size);
ok(ret == size, "GetFontData should return %u not %u\n", size, ret);
- version = GET_BE_WORD(tt_os2.version);
+ SetLastError(0xdeadbeef);
+ ret = GetTextMetricsA(hdc, &tmA);
+ ok(ret, "GetTextMetricsA error %u\n", GetLastError());
+
+ if(!get_first_last_from_cmap(hdc, &cmap_first, &cmap_last, &cmap_type))
+ {
+ skip("Unable to retrieve first and last glyphs from cmap\n");
+ }
+ else
+ {
+ USHORT expect_first_A, expect_last_A, expect_break_A, expect_default_A;
+ USHORT expect_first_W, expect_last_W, expect_break_W, expect_default_W;
+ UINT os2_first_char, os2_last_char, default_char, break_char;
+ USHORT version;
+ TEXTMETRICW tmW;
+
- trace("OS/2 chunk version %u, vendor %4.4s\n", version, (LPCSTR)&tt_os2.achVendID);
+ version = GET_BE_WORD(tt_os2.version);
- first_unicode_char = GET_BE_WORD(tt_os2.usFirstCharIndex);
- last_unicode_char = GET_BE_WORD(tt_os2.usLastCharIndex);
+ os2_first_char = GET_BE_WORD(tt_os2.usFirstCharIndex);
+ os2_last_char = GET_BE_WORD(tt_os2.usLastCharIndex);
- default_char = GET_BE_WORD(tt_os2.usDefaultChar);
- break_char = GET_BE_WORD(tt_os2.usBreakChar);
+ default_char = GET_BE_WORD(tt_os2.usDefaultChar);
+ break_char = GET_BE_WORD(tt_os2.usBreakChar);
- trace("for %s first %x, last %x, default %x, break %x\n", font_name,
- first_unicode_char, last_unicode_char, default_char, break_char);
+ trace("font %s charset %u: %x-%x (%x-%x) default %x break %x OS/2 version %u vendor %4.4s\n",
+ font_name, lf->lfCharSet, os2_first_char, os2_last_char, cmap_first, cmap_last,
+ default_char, break_char, version, (LPCSTR)&tt_os2.achVendID);
- SetLastError(0xdeadbeef);
- ret = GetTextMetricsA(hdc, &tmA);
- ok(ret, "GetTextMetricsA error %u\n", GetLastError());
- trace("A: first %x, last %x, default %x, break %x\n",
- tmA.tmFirstChar, tmA.tmLastChar, tmA.tmDefaultChar, tmA.tmBreakChar);
-
- #if 0 /* FIXME: This doesn't appear to be what Windows does */
- test_char = min(first_unicode_char - 1, 255);
- ok(tmA.tmFirstChar == test_char, "A: tmFirstChar for %s %02x != %02x\n",
- font_name, tmA.tmFirstChar, test_char);
- #endif
- if (lf->lfCharSet == SYMBOL_CHARSET)
+ if (cmap_type == cmap_ms_symbol || (cmap_first >= 0xf000 && cmap_first < 0xf100))
- {
+ {
- test_char = min(last_unicode_char - 0xf000, 255);
- ok(tmA.tmLastChar == test_char, "A: tmLastChar for %s %02x != %02x\n",
- font_name, tmA.tmLastChar, test_char);
+ expect_first_W = 0;
+ switch(GetACP())
+ {
+ case 1257: /* Baltic */
+ expect_last_W = 0xf8fd;
+ break;
+ default:
+ expect_last_W = 0xf0ff;
- }
+ }
+ expect_break_W = 0x20;
+ expect_default_W = expect_break_W - 1;
+ expect_first_A = 0x1e;
+ expect_last_A = min(os2_last_char - os2_first_char + 0x20, 0xff);
+ }
- else
- {
+ else
+ {
- test_char = min(last_unicode_char, 255);
- ok(tmA.tmLastChar == test_char, "A: tmLastChar for %s %02x != %02x\n",
- font_name, tmA.tmLastChar, test_char);
+ expect_first_W = cmap_first;
+ expect_last_W = min(cmap_last, os2_last_char);
+ if(os2_first_char <= 1)
+ expect_break_W = os2_first_char + 2;
+ else if(os2_first_char > 0xff)
+ expect_break_W = 0x20;
+ else
+ expect_break_W = os2_first_char;
+ expect_default_W = expect_break_W - 1;
+ expect_first_A = expect_default_W - 1;
+ expect_last_A = min(expect_last_W, 0xff);
- }
+ }
+ expect_break_A = expect_break_W;
+ expect_default_A = expect_default_W;
+
+ /* Wine currently uses SYMBOL_CHARSET to identify whether the ANSI metrics need special handling */
+ if(cmap_type != cmap_ms_symbol && tmA.tmCharSet == SYMBOL_CHARSET && expect_first_A != 0x1e)
+ todo_wine ok(tmA.tmFirstChar == expect_first_A ||
+ tmA.tmFirstChar == expect_first_A + 1 /* win9x */,
+ "A: tmFirstChar for %s got %02x expected %02x\n", font_name, tmA.tmFirstChar, expect_first_A);
+ else
+ ok(tmA.tmFirstChar == expect_first_A ||
+ tmA.tmFirstChar == expect_first_A + 1 /* win9x */,
+ "A: tmFirstChar for %s got %02x expected %02x\n", font_name, tmA.tmFirstChar, expect_first_A);
+ ok(tmA.tmLastChar == expect_last_A ||
+ tmA.tmLastChar == 0xff /* win9x */,
+ "A: tmLastChar for %s got %02x expected %02x\n", font_name, tmA.tmLastChar, expect_last_A);
+ ok(tmA.tmBreakChar == expect_break_A, "A: tmBreakChar for %s got %02x expected %02x\n",
+ font_name, tmA.tmBreakChar, expect_break_A);
+ ok(tmA.tmDefaultChar == expect_default_A, "A: tmDefaultChar for %s got %02x expected %02x\n",
+ font_name, tmA.tmDefaultChar, expect_default_A);
+
- SetLastError(0xdeadbeef);
- ret = GetTextMetricsW(hdc, &tmW);
- ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
- "GetTextMetricsW error %u\n", GetLastError());
- if (ret)
- {
+ SetLastError(0xdeadbeef);
+ ret = GetTextMetricsW(hdc, &tmW);
+ ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
+ "GetTextMetricsW error %u\n", GetLastError());
+ if (ret)
+ {
- trace("W: first %x, last %x, default %x, break %x\n",
- tmW.tmFirstChar, tmW.tmLastChar, tmW.tmDefaultChar,
- tmW.tmBreakChar);
-
- if (lf->lfCharSet == SYMBOL_CHARSET)
- {
- /* It appears that for fonts with SYMBOL_CHARSET Windows always
- * sets symbol range to 0 - f0ff
- */
- ok(tmW.tmFirstChar == 0, "W: tmFirstChar for %s %02x != 0\n",
- font_name, tmW.tmFirstChar);
- /* FIXME: Windows returns f0ff here, while Wine f0xx */
- ok(tmW.tmLastChar >= 0xf000, "W: tmLastChar for %s %02x < 0xf000\n",
- font_name, tmW.tmLastChar);
-
- ok(tmW.tmDefaultChar == 0x1f, "W: tmDefaultChar for %s %02x != 0x1f\n",
- font_name, tmW.tmDefaultChar);
- ok(tmW.tmBreakChar == 0x20, "W: tmBreakChar for %s %02x != 0x20\n",
- font_name, tmW.tmBreakChar);
- }
- else
- {
- ok(tmW.tmFirstChar == first_unicode_char, "W: tmFirstChar for %s %02x != %02x\n",
- font_name, tmW.tmFirstChar, first_unicode_char);
- ok(tmW.tmLastChar == last_unicode_char, "W: tmLastChar for %s %02x != %02x\n",
- font_name, tmW.tmLastChar, last_unicode_char);
- }
+ /* Wine uses the os2 first char */
+ if(cmap_first != os2_first_char && cmap_type != cmap_ms_symbol)
+ todo_wine ok(tmW.tmFirstChar == expect_first_W, "W: tmFirstChar for %s got %02x expected %02x\n",
+ font_name, tmW.tmFirstChar, expect_first_W);
+ else
+ ok(tmW.tmFirstChar == expect_first_W, "W: tmFirstChar for %s got %02x expected %02x\n",
+ font_name, tmW.tmFirstChar, expect_first_W);
+
+ /* Wine uses the os2 last char */
+ if(expect_last_W != os2_last_char && cmap_type != cmap_ms_symbol)
+ todo_wine ok(tmW.tmLastChar == expect_last_W, "W: tmLastChar for %s got %02x expected %02x\n",
+ font_name, tmW.tmLastChar, expect_last_W);
+ else
+ ok(tmW.tmLastChar == expect_last_W, "W: tmLastChar for %s got %02x expected %02x\n",
+ font_name, tmW.tmLastChar, expect_last_W);
+ ok(tmW.tmBreakChar == expect_break_W, "W: tmBreakChar for %s got %02x expected %02x\n",
+ font_name, tmW.tmBreakChar, expect_break_W);
+ ok(tmW.tmDefaultChar == expect_default_W, "W: tmDefaultChar for %s got %02x expected %02x\n",
+ font_name, tmW.tmDefaultChar, expect_default_W);
+
+ /* Test the aspect ratio while we have tmW */
- ret = GetDeviceCaps(hdc, LOGPIXELSX);
- ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectX %u != %u\n",
- tmW.tmDigitizedAspectX, ret);
- ret = GetDeviceCaps(hdc, LOGPIXELSY);
- ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectY %u != %u\n",
- tmW.tmDigitizedAspectX, ret);
- }
+ ret = GetDeviceCaps(hdc, LOGPIXELSX);
+ ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectX %u != %u\n",
+ tmW.tmDigitizedAspectX, ret);
+ ret = GetDeviceCaps(hdc, LOGPIXELSY);
+ ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectY %u != %u\n",
+ tmW.tmDigitizedAspectX, ret);
+ }
+ }
+
+ /* test FF_ values */
+ switch(tt_os2.panose.bFamilyType)
+ {
+ case PAN_ANY:
+ case PAN_NO_FIT:
+ case PAN_FAMILY_TEXT_DISPLAY:
+ case PAN_FAMILY_PICTORIAL:
+ default:
+ if((tmA.tmPitchAndFamily & 1) == 0 || /* fixed */
+ tt_os2.panose.bProportion == PAN_PROP_MONOSPACED)
+ {
+ expect_ff(&tmA, &tt_os2, FF_MODERN, font_name);
+ break;
+ }
+ switch(tt_os2.panose.bSerifStyle)
+ {
+ case PAN_ANY:
+ case PAN_NO_FIT:
+ default:
+ expect_ff(&tmA, &tt_os2, FF_DONTCARE, font_name);
+ break;
+
+ case PAN_SERIF_COVE:
+ case PAN_SERIF_OBTUSE_COVE:
+ case PAN_SERIF_SQUARE_COVE:
+ case PAN_SERIF_OBTUSE_SQUARE_COVE:
+ case PAN_SERIF_SQUARE:
+ case PAN_SERIF_THIN:
+ case PAN_SERIF_BONE:
+ case PAN_SERIF_EXAGGERATED:
+ case PAN_SERIF_TRIANGLE:
+ expect_ff(&tmA, &tt_os2, FF_ROMAN, font_name);
+ break;
+
+ case PAN_SERIF_NORMAL_SANS:
+ case PAN_SERIF_OBTUSE_SANS:
+ case PAN_SERIF_PERP_SANS:
+ case PAN_SERIF_FLARED:
+ case PAN_SERIF_ROUNDED:
+ expect_ff(&tmA, &tt_os2, FF_SWISS, font_name);
+ break;
+ }
+ break;
+
+ case PAN_FAMILY_SCRIPT:
+ expect_ff(&tmA, &tt_os2, FF_SCRIPT, font_name);
+ break;
+
+ case PAN_FAMILY_DECORATIVE:
+ expect_ff(&tmA, &tt_os2, FF_DECORATIVE, font_name);
+ break;
+ }
test_negative_width(hdc, lf);
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="gdi32_winetest" type="win32cui" installbase="bin" installname="gdi32_winetest.exe" allowwarnings="true">
- <include base="gdi32_winetest">.</include>
+ <include base="gdi32_winetest">.</include>
- <define name="WINVER">0x0600</define>
- <define name="__USE_W32API" />
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
- <library>gdi32</library>
- <library>user32</library>
- <library>advapi32</library>
- <file>bitmap.c</file>
- <file>brush.c</file>
- <file>clipping.c</file>
- <file>dc.c</file>
- <file>gdiobj.c</file>
- <file>generated.c</file>
- <file>icm.c</file>
- <file>font.c</file>
- <file>mapping.c</file>
- <file>metafile.c</file>
- <file>palette.c</file>
- <file>path.c</file>
- <file>pen.c</file>
- <file>testlist.c</file>
+ <library>ntdll</library>
+ <library>gdi32</library>
- <library>kernel32</library>
+ <library>user32</library>
+ <library>advapi32</library>
+ <file>bitmap.c</file>
+ <file>brush.c</file>
+ <file>clipping.c</file>
+ <file>dc.c</file>
+ <file>gdiobj.c</file>
+ <file>generated.c</file>
+ <file>icm.c</file>
+ <file>font.c</file>
+ <file>mapping.c</file>
+ <file>metafile.c</file>
+ <file>palette.c</file>
+ <file>path.c</file>
+ <file>pen.c</file>
+ <file>testlist.c</file>
</module>
- </group>
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_ABC(void)
{
{
int diff;
- if (emr1->iType != emr2->iType && todo)
- {
- todo_wine
- {
- ok(emr1->iType == emr2->iType, "%s: emr->iType %u != %u\n",
- desc, emr1->iType, emr2->iType);
+ ok(emr1->iType == emr2->iType, "%s: emr->iType %u != %u\n",
+ desc, emr1->iType, emr2->iType);
- }
- }
- else
- ok(emr1->iType == emr2->iType, "%s: emr->iType %u != %u\n",
- desc, emr1->iType, emr2->iType);
- if (emr1->nSize != emr2->nSize && todo)
- {
- todo_wine
- {
- ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %u != %u\n",
- desc, emr1->nSize, emr2->nSize);
+ ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %u != %u\n",
+ desc, emr1->nSize, emr2->nSize);
- }
- }
- else
- ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %u != %u\n",
- desc, emr1->nSize, emr2->nSize);
/* iType and nSize mismatches are fatal */
if (emr1->iType != emr2->iType || emr1->nSize != emr2->nSize) return FALSE;
/* contents of EMR_GDICOMMENT are not interesting */
if (emr1->iType == EMR_GDICOMMENT) return TRUE;
- diff = memcmp(emr1->dParm, emr2->dParm, emr1->nSize - sizeof(EMR));
- if (diff && todo)
+ /* different Windows versions setup DC scaling differently when
+ * converting an old style metafile to an EMF.
+ */
+ if (ignore_scaling && (emr1->iType == EMR_SETWINDOWEXTEX ||
+ emr1->iType == EMR_SETVIEWPORTEXTEX))
+ return TRUE;
+
+ if (emr1->iType == EMR_EXTTEXTOUTW || emr1->iType == EMR_EXTTEXTOUTA)
+ {
+ EMREXTTEXTOUTW *eto1, *eto2;
+
+ eto1 = HeapAlloc(GetProcessHeap(), 0, emr1->nSize);
+ memcpy(eto1, emr1, emr1->nSize);
+ eto2 = HeapAlloc(GetProcessHeap(), 0, emr2->nSize);
+ memcpy(eto2, emr2, emr2->nSize);
+
+ /* different Windows versions setup DC scaling differently */
+ eto1->exScale = eto1->eyScale = 0.0;
+ eto2->exScale = eto2->eyScale = 0.0;
+
+ diff = memcmp(eto1, eto2, emr1->nSize);
+ if (diff)
+ {
+ dump_EMREXTTEXTOUT(eto1);
+ dump_EMREXTTEXTOUT(eto2);
- }
++ }
+ HeapFree(GetProcessHeap(), 0, eto1);
+ HeapFree(GetProcessHeap(), 0, eto2);
+ }
+ else if (emr1->iType == EMR_EXTSELECTCLIPRGN && !lstrcmpA(desc, "emf_clipping"))
{
- todo_wine
- ok(diff == 0, "%s: contents of record %u don't match\n", desc, emr1->iType);
+ /* We have to take care of NT4 differences here */
+ diff = memcmp(emr1, emr2, emr1->nSize);
+ if (diff)
+ {
+ ENHMETARECORD *emr_nt4;
+
+ emr_nt4 = HeapAlloc(GetProcessHeap(), 0, emr2->nSize);
+ memcpy(emr_nt4, emr2, emr2->nSize);
+ /* Correct the nRgnSize field */
+ emr_nt4->dParm[5] = sizeof(RECT);
+
+ diff = memcmp(emr1, emr_nt4, emr1->nSize);
+ if (!diff)
+ win_skip("Catered for NT4 differences\n");
+
+ HeapFree(GetProcessHeap(), 0, emr_nt4);
+ }
}
else
- ok(diff == 0, "%s: contents of record %u don't match\n", desc, emr1->iType);
+ diff = memcmp(emr1, emr2, emr1->nSize);
+
+ ok(diff == 0, "%s: contents of record %u don't match\n", desc, emr1->iType);
if (diff)
{
mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
ok (mfsize > 0, "%s: GetEnhMetaFileBits error %d\n", desc, GetLastError());
+ /* ENHMETAHEADER size could differ, depending on platform */
+ diff_nt4 = sizeof(SIZEL);
+ diff_9x = sizeof(SIZEL) + 3 * sizeof(DWORD);
+
if (mfsize < MF_BUFSIZE)
{
- if (mfsize != bsize && todo)
- {
- todo_wine
- ok(mfsize == bsize, "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize);
+ ok(mfsize == bsize ||
+ broken(mfsize == bsize - diff_nt4) || /* NT4 */
+ broken(mfsize == bsize - diff_9x), /* Win9x/WinME */
+ "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize);
- }
- else
+ }
+ else
- ok(mfsize == bsize, "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize);
- }
- else
ok(bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d\n",
desc, mfsize, bsize);
WCHAR itsName[LF_FACESIZE];
GpStatus stat;
- /* FontFamily cannot be NULL */
+ /* FontFamily can not be NULL */
- stat = GdipCreateFontFamilyFromName (arial , NULL, family);
+ stat = GdipCreateFontFamilyFromName (arial , NULL, NULL);
expect (InvalidParameter, stat);
- family = GdipAlloc (sizeof (GpFontFamily*));
-
/* FontFamily must be able to actually find the family.
- * If it can't, any subsequent calls should fail
- *
- * We currently fail (meaning we don't) because we don't actually
- * test to see if we can successfully get a family
+ * If it can't, any subsequent calls should fail.
*/
- stat = GdipCreateFontFamilyFromName (nonexistant, NULL, family);
+ stat = GdipCreateFontFamilyFromName (nonexistent, NULL, &family);
expect (FontFamilyNotFound, stat);
- stat = GdipGetFamilyName (*family,itsName, LANG_NEUTRAL);
- expect (InvalidParameter, stat);
- ok ((lstrcmpiW(itsName,nonexistant) != 0),
- "Expected a non-zero value for nonexistant font!\n");
- stat = GdipDeleteFontFamily(*family);
- expect (InvalidParameter, stat);
- stat = GdipCreateFontFamilyFromName (arial, NULL, family);
+ /* Bitmap fonts are not found */
+ todo_wine
+ {
+ stat = GdipCreateFontFamilyFromName (MSSansSerif, NULL, &family);
+ expect (FontFamilyNotFound, stat);
+ }
+
+ stat = GdipCreateFontFamilyFromName (arial, NULL, &family);
+ if(stat == FontFamilyNotFound)
+ {
+ skip("Arial not installed\n");
+ return;
+ }
expect (Ok, stat);
- stat = GdipGetFamilyName (*family, itsName, LANG_NEUTRAL);
+ stat = GdipGetFamilyName (family, itsName, LANG_NEUTRAL);
expect (Ok, stat);
- expect (0, lstrcmpiW(itsName, arial));
+ expect (0, lstrcmpiW(itsName,arial));
if (0)
{
GdipCreateFromHDC(hdc, &graphics1);
GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
stat = GdipSaveGraphics(graphics1, &state_a);
- todo_wine
- expect(Ok, stat);
+ expect(Ok, stat);
GdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
stat = GdipRestoreGraphics(graphics1, state_a);
- todo_wine
- expect(Ok, stat);
+ expect(Ok, stat);
GdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBilinear, mode);
GdipSaveGraphics(graphics1, &state_b);
GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
stat = GdipRestoreGraphics(graphics1, 0xdeadbeef);
- todo_wine
- expect(Ok, stat);
+ expect(Ok, stat);
GdipRestoreGraphics(graphics1, state_b);
GdipGetInterpolationMode(graphics1, &mode);
todo_wine
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="icmp_winetest" type="win32cui" installbase="bin" installname="icmp_winetest.exe" allowwarnings="true">
- <include base="icmp_winetest">.</include>
+ <include base="icmp_winetest">.</include>
- <define name="__USE_W32API" />
- <library>kernel32</library>
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
- <library>icmp</library>
- <file>icmp.c</file>
- <file>testlist.c</file>
+ <library>ntdll</library>
+ <library>icmp</library>
+ <file>icmp.c</file>
+ <file>testlist.c</file>
</module>
- </group>
msg_spy_flush_msgs();
ImmReleaseContext(hwnd, imc);
- }
+ }
+
+ static void test_ImmGetCompositionString(void)
+ {
+ HIMC imc;
+ static const WCHAR string[] = {'w','i','n','e',0x65e5,0x672c,0x8a9e};
+ char cstring[20];
+ WCHAR wstring[20];
+ DWORD len;
+ DWORD alen,wlen;
+
+ imc = ImmGetContext(hwnd);
+ ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL,0);
+ alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20);
+ wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 20);
+ /* windows machines without any IME installed just return 0 above */
+ if( alen && wlen)
+ {
+ len = ImmGetCompositionStringW(imc, GCS_COMPATTR, NULL, 0);
+ ok(len*sizeof(WCHAR)==wlen,"GCS_COMPATTR(W) not returning correct count\n");
+ len = ImmGetCompositionStringA(imc, GCS_COMPATTR, NULL, 0);
+ ok(len==alen,"GCS_COMPATTR(A) not returning correct count\n");
++}
+ ImmReleaseContext(hwnd, imc);
+ }
+
+ static void test_ImmSetCompositionString(void)
+ {
+ HIMC imc;
+ BOOL ret;
+
+ SetLastError(0xdeadbeef);
+ imc = ImmGetContext(hwnd);
+ ok(imc != 0, "ImmGetContext() failed. Last error: %u\n", GetLastError());
+ if (!imc)
+ return;
+
+ ret = ImmSetCompositionStringW(imc, SCS_SETSTR, NULL, 0, NULL, 0);
+ todo_wine
+ ok(!ret, "ImmSetCompositionStringW() succeeded.\n");
+
+ ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGEATTR,
+ NULL, 0, NULL, 0);
+ todo_wine
+ ok(!ret, "ImmSetCompositionStringW() succeeded.\n");
+
+ ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGECLAUSE,
+ NULL, 0, NULL, 0);
+ todo_wine
+ ok(!ret, "ImmSetCompositionStringW() succeeded.\n");
+
+ ret = ImmSetCompositionStringW(imc, SCS_CHANGEATTR | SCS_CHANGECLAUSE,
+ NULL, 0, NULL, 0);
+ todo_wine
+ ok(!ret, "ImmSetCompositionStringW() succeeded.\n");
+
+ ImmReleaseContext(hwnd, imc);
+ }
+
+ static void test_ImmIME(void)
+ {
+ HIMC imc;
- return 0;
+ imc = ImmGetContext(hwnd);
+ if (imc)
+ {
+ BOOL rc;
+ rc = ImmConfigureIMEA(imc, NULL, IME_CONFIG_REGISTERWORD, NULL);
+ ok (rc == 0, "ImmConfigureIMEA did not fail\n");
+ rc = ImmConfigureIMEW(imc, NULL, IME_CONFIG_REGISTERWORD, NULL);
+ ok (rc == 0, "ImmConfigureIMEW did not fail\n");
+ }
+ ImmReleaseContext(hwnd,imc);
}
START_TEST(imm32) {
BOOL ret;
ret = ClearCommError(hcom, &errors, &comstat);
- if (!ret && GetLastError() == ERROR_NOT_READY)
+ if (!ret && (GetLastError() == ERROR_NOT_READY || GetLastError() == ERROR_INVALID_HANDLE))
{
- trace("%s doesn't respond, skipping the test\n", port_name);
+ if (GetLastError() == ERROR_NOT_READY)
+ trace("%s doesn't respond, skipping the test\n", port_name);
+ else
+ trace("%s is not a real serial port, skipping the test\n", port_name);
CloseHandle(hcom);
return INVALID_HANDLE_VALUE;
}
okCHAR(hCon, c, mytest[p], TEST_ATTRIB);
}
c.X = sbSize.X - 9 + p;
- okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
+ ReadConsoleOutputAttribute(hCon, &attr, 1, c, &len);
+ if (attr == TEST_ATTRIB)
+ win_skip("Win9x/WinMe changes attribs for '\\n' up to 'f'\n");
+ else
+ okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
c.X = 0; c.Y++;
okCHAR(hCon, c, mytest[5], TEST_ATTRIB);
for (c.X = 1; c.X < 8; c.X++)
c.X = 0; c.Y++;
okCHAR(hCon, c, mytest[3], TEST_ATTRIB);
c.X++;
- okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
+ ReadConsoleOutputAttribute(hCon, &attr, 1, c, &len);
+ if (attr == TEST_ATTRIB)
+ win_skip("Win9x/WinMe changes attribs for '\\n' up to 'f'\n");
+ else
+ okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
c.X = 0; c.Y++;
okCHAR(hCon, c, mytest[5], TEST_ATTRIB);
else
blackbox.debug_rc=TRUE;
- get_events(logfile, &start_event, &done_event);
+ if (logfile)
+ {
+ get_events(logfile, &start_event, &done_event);
+ }
+
if (strstr(myARGV[2], "order"))
{
trace("debugger: waiting for the start signal...\n");
else
blackbox.detach_rc=TRUE;
- save_blackbox(logfile, &blackbox, sizeof(blackbox));
+ if (logfile)
+ {
+ save_blackbox(logfile, &blackbox, sizeof(blackbox));
+ }
trace("debugger: done debugging...\n");
SetEvent(done_event);
ret=RegCreateKeyExA(HKEY_LOCAL_MACHINE, AeDebug, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &disposition);
if (ret == ERROR_SUCCESS)
{
- auto_size=0;
- ret=RegQueryValueExA(hkey, "auto", NULL, &auto_type, NULL, &auto_size);
- if (ret == ERROR_SUCCESS)
- {
- auto_val=HeapAlloc(GetProcessHeap(), 0, auto_size);
- RegQueryValueExA(hkey, "auto", NULL, &auto_type, auto_val, &auto_size);
+ save_value(hkey, "auto", &auto_value);
+ save_value(hkey, "debugger", &debugger_value);
+ trace("HKLM\\%s\\debugger is set to '%s'\n", AeDebug, debugger_value.data);
- }
+ }
-
- debugger_size=0;
- ret=RegQueryValueExA(hkey, "debugger", NULL, &debugger_type, NULL, &debugger_size);
- if (ret == ERROR_SUCCESS)
- {
- debugger_val=HeapAlloc(GetProcessHeap(), 0, debugger_size);
- RegQueryValueExA(hkey, "debugger", NULL, &debugger_type, debugger_val, &debugger_size);
- }
- }
else if (ret == ERROR_ACCESS_DENIED)
{
skip("not enough privileges to change the debugger\n");
return;
}
- if (debugger_val && debugger_type == REG_SZ &&
- strstr((char*)debugger_val, "winedbg --auto"))
+ if (debugger_value.data && debugger_value.type == REG_SZ &&
+ strstr((char*)debugger_value.data, "winedbg --auto"))
+ {
+ HKEY hkeyWinedbg;
+ ret=RegCreateKeyA(HKEY_CURRENT_USER, WineDbg, &hkeyWinedbg);
+ if (ret == ERROR_SUCCESS)
+ {
+ static DWORD zero;
+ reg_save_value crash_dlg_value;
+ save_value(hkeyWinedbg, "ShowCrashDialog", &crash_dlg_value);
+ RegSetValueExA(hkeyWinedbg, "ShowCrashDialog", 0, REG_DWORD, (BYTE *)&zero, sizeof(DWORD));
- crash_and_winedbg(hkey, test_exe);
+ crash_and_winedbg(hkey, test_exe);
+ restore_value(hkeyWinedbg, &crash_dlg_value);
+ RegCloseKey(hkeyWinedbg);
+ }
+ else
+ ok(0, "Couldn't access WineDbg Key - error %u\n", ret);
+ }
- crash_and_debug(hkey, test_exe, "dbg,none");
+ if (winetest_interactive)
+ /* Since the debugging process never sets the debug event, it isn't recognized
+ as a valid debugger and, after the debugger exits, Windows will show a dialog box
+ asking the user what to do */
+ crash_and_debug(hkey, test_exe, "dbg,none");
+ else
+ skip("\"none\" debugger test needs user interaction\n");
crash_and_debug(hkey, test_exe, "dbg,event,order");
crash_and_debug(hkey, test_exe, "dbg,attach,event,code2");
if (pDebugSetProcessKillOnExit)
}
else
{
- if (auto_val)
- {
- RegSetValueExA(hkey, "auto", 0, auto_type, auto_val, auto_size);
- HeapFree(GetProcessHeap(), 0, auto_val);
+ restore_value(hkey, &auto_value);
+ restore_value(hkey, &debugger_value);
+ RegCloseKey(hkey);
- }
+ }
- else
- RegDeleteValueA(hkey, "auto");
- if (debugger_val)
+ }
+
+ static void test_RemoteDebugger(void)
-{
+ {
- RegSetValueExA(hkey, "debugger", 0, debugger_type, debugger_val, debugger_size);
- HeapFree(GetProcessHeap(), 0, debugger_val);
+ BOOL bret, present;
+ if(!pCheckRemoteDebuggerPresent)
+ {
+ win_skip("CheckRemoteDebuggerPresent is not available\n");
+ return;
- }
+ }
- else
- RegDeleteValueA(hkey, "debugger");
- RegCloseKey(hkey);
+ present = TRUE;
+ SetLastError(0xdeadbeef);
+ bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),&present);
+ ok(bret , "expected CheckRemoteDebuggerPresent to succeed\n");
+ ok(0xdeadbeef == GetLastError(),
+ "expected error to be unchanged, got %d/%x\n",GetLastError(), GetLastError());
+
+ present = TRUE;
+ SetLastError(0xdeadbeef);
+ bret = pCheckRemoteDebuggerPresent(NULL,&present);
+ ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
+ ok(present, "expected parameter to be unchanged\n");
+ ok(ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
+
+ SetLastError(0xdeadbeef);
+ bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),NULL);
+ ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
+ ok(ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
-}
+ }
- }
START_TEST(debugger)
{
static const WCHAR fooW[] = {'f','o','o',0};
len_with_null = GetWindowsDirectoryW(NULL, 0);
- if (len_with_null == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ 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);
static const WCHAR fooW[] = {'f','o','o',0};
len_with_null = GetSystemDirectoryW(NULL, 0);
- if (len_with_null == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ 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);
static const WCHAR questionW[] = {'?',0};
ret = CreateDirectoryW(NULL, NULL);
- if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("CreateDirectoryW is not available\n");
return;
- ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path\n");
+ }
+ ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
+ "should not create NULL path ret %u err %u\n", ret, GetLastError());
ret = CreateDirectoryW(empty_strW, NULL);
- ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path\n");
+ ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
+ "should not create empty path ret %u err %u\n", ret, GetLastError());
ret = GetSystemDirectoryW(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
lstrcatW(tmpdir, slashW);
lstrcatW(tmpdir, tmp_dir_name);
ret = CreateDirectoryW(tmpdir, NULL);
- ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
+ ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
- "CreateDirectoryW with multiple nonexistent directories in path should fail\n");
+ "CreateDirectoryW with multiple nonexistent directories in path should fail ret %u err %u\n",
+ ret, GetLastError());
ret = RemoveDirectoryW(tmpdir);
}
GetTempPathW(MAX_PATH, tmpdir);
lstrcatW(tmpdir, tmp_dir_name);
ret = CreateDirectoryW(tmpdir, NULL);
- if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("CreateDirectoryW is not available\n");
- return;
+ return;
+ }
ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
{
type = GetDriveTypeW(drive);
- if (type == DRIVE_UNKNOWN && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (type == DRIVE_UNKNOWN && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
{
- /* Must be Win9x which doesn't support the Unicode functions */
+ win_skip("GetDriveTypeW is not available on Win9x\n");
return;
}
- ok(type > 0 && type <= 6, "not a valid drive %c: type %u\n", drive[0], type);
+ ok(type > DRIVE_UNKNOWN && type <= DRIVE_RAMDISK,
+ "not a valid drive %c: type %u\n", drive[0], type);
if (!(logical_drives & 1))
ok(type == DRIVE_NO_ROOT_DIR,
static const WCHAR unix_style_root_pathW[] = { '/', 0 };
ret = GetDiskFreeSpaceW(NULL, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
- if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (ret == 0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
{
- /* Must be Win9x which doesn't support the Unicode functions */
+ win_skip("GetDiskFreeSpaceW is not available\n");
return;
}
ok(ret, "GetDiskFreeSpaceW error %d\n", GetLastError());
DWORD ret;
ret = GetTempPathW(MAX_PATH, temp_path);
- if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("GetTempPathW is not available\n");
return;
+ }
ok(ret != 0, "GetTempPathW error %d\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = DeleteFileA(filename);
ok(ret, "DeleteFileA: error %d\n", GetLastError());
- }
+
+ /* get windows drive letter */
+ ret = GetWindowsDirectory(windowsdir, sizeof(windowsdir));
+ ok(ret < sizeof(windowsdir), "windowsdir is abnormally long!\n");
+ ok(ret != 0, "GetWindowsDirectory: error %d\n", GetLastError());
+
+ /* test error return codes from CreateFile for some cases */
+ ret = GetTempPathA(MAX_PATH, temp_path);
+ ok(ret != 0, "GetTempPathA error %d\n", GetLastError());
+ strcpy(dirname, temp_path);
+ strcat(dirname, directory);
+ ret = CreateDirectory(dirname, NULL);
+ ok( ret, "Createdirectory failed, gle=%d\n", GetLastError() );
+ /* set current drive & directory to known location */
+ SetCurrentDirectoryA( temp_path );
+ i = 0;
+ while (p[i].file)
+ {
+ filename[0] = 0;
+ /* update the drive id in the table entry with the current one */
+ if (p[i].file[1] == ':')
+ {
+ strcpy(filename, p[i].file);
+ filename[0] = windowsdir[0];
++}
+ else if (p[i].file[0] == '\\' && p[i].file[5] == ':')
+ {
+ strcpy(filename, p[i].file);
+ filename[4] = windowsdir[0];
+ }
+ else
+ {
+ /* prefix the table entry with the current temp directory */
+ strcpy(filename, temp_path);
+ strcat(filename, p[i].file);
+ }
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ p[i].options, NULL );
+ /* if we get ACCESS_DENIED when we do not expect it, assume
+ * no access to the volume
+ */
+ if (hFile == INVALID_HANDLE_VALUE &&
+ GetLastError() == ERROR_ACCESS_DENIED &&
+ p[i].err != ERROR_ACCESS_DENIED)
+ {
+ if (p[i].todo_flag)
+ skip("Either no authority to volume, or is todo_wine for %s err=%d should be %d\n", filename, GetLastError(), p[i].err);
+ else
+ skip("Do not have authority to access volumes. Test for %s skipped\n", filename);
+ }
+ /* otherwise validate results with expectations */
+ else if (p[i].todo_flag)
+ todo_wine ok(
+ (hFile == INVALID_HANDLE_VALUE &&
+ (p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
+ (hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
+ "CreateFileA failed on %s, hFile %p, err=%u, should be %u\n",
+ filename, hFile, GetLastError(), p[i].err);
+ else
+ ok(
+ (hFile == INVALID_HANDLE_VALUE &&
+ (p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
+ (hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
+ "CreateFileA failed on %s, hFile %p, err=%u, should be %u\n",
+ filename, hFile, GetLastError(), p[i].err);
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle( hFile );
+ i++;
+ }
+ ret = RemoveDirectoryA(dirname);
+ ok(ret, "RemoveDirectoryA: error %d\n", GetLastError());
+
+
+ /* test opening directory as a directory */
+ hFile = CreateFileA( temp_path, GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL );
+ if (hFile != INVALID_HANDLE_VALUE && GetLastError() != ERROR_PATH_NOT_FOUND)
+ {
+ ok(hFile != INVALID_HANDLE_VALUE && GetLastError() == ERROR_SUCCESS,
+ "CreateFileA did not work, last error %u on volume <%s>\n",
+ GetLastError(), temp_path );
+
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ ret = GetFileInformationByHandle( hFile, &Finfo );
+ if (ret)
+ {
+ ok(Finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY,
+ "CreateFileA probably did not open temp directory %s correctly\n file information does not include FILE_ATTRIBUTE_DIRECTORY, actual=0x%08x\n",
+ temp_path, Finfo.dwFileAttributes);
+ }
+ CloseHandle( hFile );
+ }
+ }
+ else
+ skip("Probable Win9x, got ERROR_PATH_NOT_FOUND w/ FILE_FLAG_BACKUP_SEMANTICS or %s\n", temp_path);
+
+
+ /* *** Test opening volumes/devices using drive letter *** */
+
+ /* test using drive letter in non-rewrite format without trailing \ */
+ /* this should work */
+ strcpy(filename, nt_drive);
+ filename[4] = windowsdir[0];
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
+ if (hFile != INVALID_HANDLE_VALUE ||
+ (GetLastError() != ERROR_ACCESS_DENIED && GetLastError() != ERROR_BAD_NETPATH))
+ {
+ /* if we have adm rights to volume, then try rest of tests */
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA did not open %s, last error=%u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ /* if we opened the volume/device, try to read it. Since it */
+ /* opened, we should be able to read it. We don't care about*/
+ /* what the data is at this time. */
+ len = 512;
+ ret = ReadFile( hFile, buffer, len, &len, NULL );
+ todo_wine ok(ret, "Failed to read volume, last error %u, %u, for %s\n",
+ GetLastError(), ret, filename);
+ if (ret)
+ {
+ trace("buffer is\n");
+ dumpmem(buffer, 64);
+ }
+ CloseHandle( hFile );
+ }
+
+ /* test using drive letter with trailing \ and in non-rewrite */
+ /* this should not work */
+ strcpy(filename, nt_drive);
+ filename[4] = windowsdir[0];
+ strcat( filename, "\\" );
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
+ todo_wine
+ ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
+ "CreateFileA should have returned ERROR_PATH_NOT_FOUND on %s, but got %u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle( hFile );
+
+ /* test using temp path with trailing \ and in non-rewrite as dir */
+ /* this should work */
+ strcpy(filename, nt_drive);
+ filename[4] = 0;
+ strcat( filename, temp_path );
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL );
+ ok(hFile != INVALID_HANDLE_VALUE,
+ "CreateFileA should have worked on %s, but got %u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle( hFile );
+
+ /* test using drive letter without trailing \ and in device ns */
+ /* this should work */
+ strcpy(filename, nt_drive);
+ filename[4] = windowsdir[0];
+ filename[2] = '.';
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA did not open %s, last error=%u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle( hFile );
+ }
+ /* If we see ERROR_BAD_NETPATH then on Win9x or WinME, so skip */
+ else if (GetLastError() == ERROR_BAD_NETPATH)
+ skip("Probable Win9x, got ERROR_BAD_NETPATH (53)\n");
+ else
+ skip("Do not have authority to access volumes. Tests skipped\n");
+
+
+ /* *** Test opening volumes/devices using GUID *** */
+
+ if (pGetVolumeNameForVolumeMountPointA)
+ {
+ strcpy(filename, "c:\\");
+ filename[0] = windowsdir[0];
+ ret = pGetVolumeNameForVolumeMountPointA( filename, Volume_1, MAX_PATH );
+ ok(ret, "GetVolumeNameForVolumeMountPointA failed, for %s, last error=%d\n", filename, GetLastError());
+ if (ret)
+ {
+ ok(strlen(Volume_1) == 49, "GetVolumeNameForVolumeMountPointA returned wrong length name <%s>\n", Volume_1);
+
+ /* test the result of opening a unique volume name (GUID)
+ * with the trailing \
+ * this should error out
+ */
+ strcpy(filename, Volume_1);
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
+ todo_wine
+ ok(hFile == INVALID_HANDLE_VALUE,
+ "CreateFileA should not have opened %s, hFile %p\n",
+ filename, hFile);
+ todo_wine
+ ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
+ "CreateFileA should have returned ERROR_PATH_NOT_FOUND on %s, but got %u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle( hFile );
+
+ /* test the result of opening a unique volume name (GUID)
+ * with the temp path string as dir
+ * this should work
+ */
+ strcpy(filename, Volume_1);
+ strcat(filename, temp_path+3);
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL );
+ todo_wine
+ ok(hFile != INVALID_HANDLE_VALUE,
+ "CreateFileA should have opened %s, but got %u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle( hFile );
+
+ /* test the result of opening a unique volume name (GUID)
+ * without the trailing \ and in device namespace
+ * this should work
+ */
+ strcpy(filename, Volume_1);
+ filename[2] = '.';
+ filename[48] = 0;
+ hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
+ if (hFile != INVALID_HANDLE_VALUE || GetLastError() != ERROR_ACCESS_DENIED)
+ {
+ /* if we have adm rights to volume, then try rest of tests */
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA did not open %s, last error=%u\n",
+ filename, GetLastError());
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ /* if we opened the volume/device, try to read it. Since it */
+ /* opened, we should be able to read it. We don't care about*/
+ /* what the data is at this time. */
+ len = 512;
+ ret = ReadFile( hFile, buffer, len, &len, NULL );
+ todo_wine ok(ret, "Failed to read volume, last error %u, %u, for %s\n",
+ GetLastError(), ret, filename);
+ if (ret)
+ {
+ trace("buffer is\n");
+ dumpmem(buffer, 64);
+ }
+ CloseHandle( hFile );
+ }
+ }
+ else
+ skip("Do not have authority to access volumes. Tests skipped\n");
+ }
+ else
+ win_skip("GetVolumeNameForVolumeMountPointA not functioning\n");
+ }
+ else
+ win_skip("GetVolumeNameForVolumeMountPointA not found\n");
}
static void test_CreateFileW(void)
DWORD ret;
ret = GetTempPathW(MAX_PATH, temp_path);
- if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("GetTempPathW is not available\n");
return;
+ }
ok(ret != 0, "GetTempPathW error %d\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
static const WCHAR emptyW[]={'\0'};
ret = DeleteFileW(NULL);
- if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("DeleteFileW is not available\n");
return;
+ }
ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
"DeleteFileW(NULL) returned ret=%d error=%d\n",ret,GetLastError());
ret = DeleteFileW(emptyW);
ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
"DeleteFileW(\"\") returned ret=%d error=%d\n",ret,GetLastError());
- }
+
+ /* test DeleteFile on empty directory */
+ ret = GetTempPathW(MAX_PATH, pathW);
+ if (ret + sizeof(dirW)/sizeof(WCHAR)-1 + sizeof(subdirW)/sizeof(WCHAR)-1 >= MAX_PATH)
+ {
+ ok(0, "MAX_PATH exceeded in constructing paths\n");
+ return;
++}
+ lstrcatW(pathW, dirW);
+ lstrcpyW(pathsubW, pathW);
+ lstrcatW(pathsubW, subdirW);
+ ret = CreateDirectoryW(pathW, NULL);
+ ok(ret == TRUE, "couldn't create directory deletefile\n");
+ ret = DeleteFileW(pathW);
+ ok(ret == FALSE, "DeleteFile should fail for empty directories\n");
+ ret = RemoveDirectoryW(pathW);
+ ok(ret == TRUE, "expected to remove directory deletefile\n");
+
+ /* test DeleteFile on non-empty directory */
+ ret = CreateDirectoryW(pathW, NULL);
+ ok(ret == TRUE, "couldn't create directory deletefile\n");
+ ret = CreateDirectoryW(pathsubW, NULL);
+ ok(ret == TRUE, "couldn't create directory deletefile\\sub\n");
+ ret = DeleteFileW(pathW);
+ ok(ret == FALSE, "DeleteFile should fail for non-empty directories\n");
+ ret = RemoveDirectoryW(pathsubW);
+ ok(ret == TRUE, "expected to remove directory deletefile\\sub\n");
+ ret = RemoveDirectoryW(pathW);
+ ok(ret == TRUE, "expected to remove directory deletefile\n");
}
#define IsDotDir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
DWORD ret;
ret = GetTempPathW(MAX_PATH, temp_path);
- if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("GetTempPathW is not available\n");
return;
+ }
ok(ret != 0, "GetTempPathW error %d\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
"UnlockFileEx 150,100 again succeeded\n" );
}
- ok( LockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "LockFile failed\n" );
+ ret = LockFile( handle, 0, 0x10000000, 0, 0xf0000000 );
+ if (ret)
+ {
- ok( !LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 succeeded\n" );
- ok( !LockFile( handle, 0, 0x20000000, 20, 0 ), "LockFile 0x20000000,20 succeeded\n" );
- ok( UnlockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "UnlockFile failed\n" );
+ ok( !LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 succeeded\n" );
+ ok( !LockFile( handle, 0, 0x20000000, 20, 0 ), "LockFile 0x20000000,20 succeeded\n" );
+ ok( UnlockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "UnlockFile failed\n" );
+ }
+ else /* win9x */
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong LockFile error %u\n", GetLastError() );
/* wrap-around lock should not do anything */
/* (but still succeeds on NT4 so we don't check result) */
err = GetLastError();
ok( handle != INVALID_HANDLE_VALUE, "FindFirstFile on %s failed\n", buffer2 );
ok( 0 == lstrcmpiA(data.cFileName, "nul"), "wrong name %s\n", data.cFileName );
- ok( 0 == data.nFileSizeHigh, "wrong size %d\n", data.nFileSizeHigh );
- ok( 0 == data.nFileSizeLow, "wrong size %d\n", data.nFileSizeLow );
+ ok( FILE_ATTRIBUTE_ARCHIVE == data.dwFileAttributes ||
+ FILE_ATTRIBUTE_DEVICE == data.dwFileAttributes /* Win9x */,
+ "wrong attributes %x\n", data.dwFileAttributes );
+ if (data.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)
+ {
- ok( FILE_ATTRIBUTE_ARCHIVE == data.dwFileAttributes, "wrong attributes %x\n", data.dwFileAttributes );
+ ok( 0 == data.nFileSizeHigh, "wrong size %d\n", data.nFileSizeHigh );
+ ok( 0 == data.nFileSizeLow, "wrong size %d\n", data.nFileSizeLow );
+ }
SetLastError( 0xdeadbeaf );
ok( !FindNextFileA( handle, &data ), "FindNextFileA succeeded\n" );
ok( GetLastError() == ERROR_NO_MORE_FILES, "bad error %d\n", GetLastError() );
err = GetLastError();
ok( handle != INVALID_HANDLE_VALUE, "FindFirstFile on %s failed\n", buffer2 );
ok( 0 == lstrcmpiA(data.cFileName, "lpt1"), "wrong name %s\n", data.cFileName );
- ok( 0 == data.nFileSizeHigh, "wrong size %d\n", data.nFileSizeHigh );
- ok( 0 == data.nFileSizeLow, "wrong size %d\n", data.nFileSizeLow );
+ ok( FILE_ATTRIBUTE_ARCHIVE == data.dwFileAttributes ||
+ FILE_ATTRIBUTE_DEVICE == data.dwFileAttributes /* Win9x */,
+ "wrong attributes %x\n", data.dwFileAttributes );
+ if (data.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)
+ {
- ok( FILE_ATTRIBUTE_ARCHIVE == data.dwFileAttributes, "wrong attributes %x\n", data.dwFileAttributes );
+ ok( 0 == data.nFileSizeHigh, "wrong size %d\n", data.nFileSizeHigh );
+ ok( 0 == data.nFileSizeLow, "wrong size %d\n", data.nFileSizeLow );
+ }
SetLastError( 0xdeadbeaf );
ok( !FindNextFileA( handle, &data ), "FindNextFileA succeeded\n" );
ok( GetLastError() == ERROR_NO_MORE_FILES, "bad error %d\n", GetLastError() );
memset( &ov, 0, sizeof ov );
result = 1;
r = GetOverlappedResult(0, &ov, &result, 0);
- ok( r == TRUE, "should return false\n");
+ if (r)
- ok( result == 0, "wrong result %u\n", result );
+ ok( result == 0, "wrong result %u\n", result );
+ else /* win9x */
+ ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
result = 0;
ov.Internal = 0;
ov.InternalHigh = 0xabcd;
r = GetOverlappedResult(0, &ov, &result, 0);
- ok( r == TRUE, "should return false\n");
+ if (r)
- ok( result == 0xabcd, "wrong result %u\n", result );
+ ok( result == 0xabcd, "wrong result %u\n", result );
+ else /* win9x */
+ ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
SetLastError( 0xb00 );
result = 0;
ok( rc, "SetCurrentDirectory failed, gle=%d\n", GetLastError() );
rc = RemoveDirectory(".");
- todo_wine {
- ok( !rc, "RemoveDirectory unexpectedly worked\n" );
- }
-
+ if (!rc)
+ {
- rc = SetCurrentDirectory("..");
- ok( rc, "SetCurrentDirectory failed, gle=%d\n", GetLastError() );
+ rc = SetCurrentDirectory("..");
+ ok( rc, "SetCurrentDirectory failed, gle=%d\n", GetLastError() );
- rc = RemoveDirectory(directory);
- ok( rc, "RemoveDirectory failed, gle=%d\n", GetLastError() );
+ rc = RemoveDirectory(directory);
- todo_wine {
+ ok( rc, "RemoveDirectory failed, gle=%d\n", GetLastError() );
}
}
/* make sure that the "replaced" file has the size of the replacement file */
hReplacedFile = CreateFileA(replaced, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
ok(hReplacedFile != INVALID_HANDLE_VALUE,
- "failed to open replaced file\n");
+ "failed to open replaced file: %d\n", GetLastError());
+ if (hReplacedFile != INVALID_HANDLE_VALUE)
+ {
- ret = GetFileSize(hReplacedFile, NULL);
- ok(ret == sizeof(replacementData),
- "replaced file has wrong size %d\n", ret);
- /* make sure that the replacement file no-longer exists */
- hReplacementFile = CreateFileA(replacement, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
- ok(hReplacementFile == INVALID_HANDLE_VALUE,
- "unexpected error, replacement file should not exist %d\n", GetLastError());
- /* make sure that the backup has the old "replaced" filetime */
- ret = GetFileTime(hBackupFile, NULL, NULL, &ftBackup);
- ok( ret, "GetFileTime error (backup %d\n", GetLastError());
+ ret = GetFileSize(hReplacedFile, NULL);
+ ok(ret == sizeof(replacementData),
+ "replaced file has wrong size %d\n", ret);
+ /* make sure that the replacement file no-longer exists */
+ hReplacementFile = CreateFileA(replacement, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+ ok(hReplacementFile == INVALID_HANDLE_VALUE,
+ "unexpected error, replacement file should not exist %d\n", GetLastError());
+ /* make sure that the backup has the old "replaced" filetime */
+ ret = GetFileTime(hBackupFile, NULL, NULL, &ftBackup);
+ ok( ret, "GetFileTime error (backup %d\n", GetLastError());
- ok(CompareFileTime(&ftBackup, &ftReplaced) == 0,
- "backup file has wrong filetime\n");
+ ok(check_file_time(&ftBackup, &ftReplaced, 20000000), "backup file has wrong filetime\n");
- CloseHandle(hBackupFile);
- /* make sure that the "replaced" has the old replacement filetime */
- ret = GetFileTime(hReplacedFile, NULL, NULL, &ftReplaced);
- ok( ret, "GetFileTime error (backup %d\n", GetLastError());
+ CloseHandle(hBackupFile);
+ /* make sure that the "replaced" has the old replacement filetime */
+ ret = GetFileTime(hReplacedFile, NULL, NULL, &ftReplaced);
+ ok( ret, "GetFileTime error (backup %d\n", GetLastError());
- ok(CompareFileTime(&ftReplaced, &ftReplacement) == 0,
- "replaced file has wrong filetime\n");
+ ok(check_file_time(&ftReplaced, &ftReplacement, 20000000),
+ "replaced file has wrong filetime %x%08x / %x%08x\n",
+ ftReplaced.dwHighDateTime, ftReplaced.dwLowDateTime,
+ ftReplacement.dwHighDateTime, ftReplacement.dwLowDateTime );
- CloseHandle(hReplacedFile);
+ CloseHandle(hReplacedFile);
+ }
+ else
+ skip("couldn't open replacement file, skipping tests\n");
/* re-create replacement file for pass w/o backup (blank) */
ret = GetTempFileNameA(temp_path, prefix, 0, replacement);
*/
SetLastError(0xdeadbeef);
ret = pReplaceFileA(replaced, replacement, backup, 0, 0, 0);
- ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
+ ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND ||
+ GetLastError() == ERROR_ACCESS_DENIED),
- "ReplaceFileA: unexpected error %d\n", GetLastError());
+ "ReplaceFileA: unexpected error %d\n", GetLastError());
/* perform replacement w/o existing "replacement" file
* TODO: flags are not implemented
*/
/* delete temporary files, replacement and replaced are already deleted */
- ret = DeleteFileA(backup);
+ if (removeBackup)
+ {
- ok(ret, "DeleteFileA: error (backup) %d\n", GetLastError());
+ ret = DeleteFileA(backup);
- }
+ ok(ret ||
+ broken(GetLastError() == ERROR_ACCESS_DENIED), /* win2k */
+ "DeleteFileA: error (backup) %d\n", GetLastError());
++}
}
/*
}
ret = GetTempPathW(MAX_PATH, temp_path);
- if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (ret==0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("GetTempPathW is not available\n");
return;
+ }
ok(ret != 0, "GetTempPathW error %d\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ok(!ret, "ReplaceFileW: error %d\n", GetLastError());
ret = pReplaceFileW(replaced, replacement, NULL, 0, 0, 0);
- ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
+ ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND ||
+ GetLastError() == ERROR_ACCESS_DENIED),
"ReplaceFileW: unexpected error %d\n", GetLastError());
- ret = DeleteFileW(backup);
+ if (removeBackup)
+ {
- ok(ret, "DeleteFileW: error %d\n", GetLastError());
+ ret = DeleteFileW(backup);
- }
+ ok(ret ||
+ broken(GetLastError() == ERROR_ACCESS_DENIED), /* win2k */
+ "DeleteFileW: error (backup) %d\n", GetLastError());
++}
}
START_TEST(file)
/* #define ok(cond,failstr) if(!(cond)) {printf("line %d : %s\n",__LINE__,failstr);exit(1);} */
- static DWORD doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id,
+ static DWORD __cdecl doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id,
- LPSTR out, DWORD outsize, ... )
+ LPSTR out, DWORD outsize, ... )
{
- va_list list;
+ __ms_va_list list;
DWORD r;
- va_start(list, outsize);
+ __ms_va_start(list, outsize);
r = FormatMessageA(flags, src, msg_id,
lang_id, out, outsize, &list);
- va_end(list);
+ __ms_va_end(list);
return r;
}
ok(mem == NULL, "Expected NULL, got %p\n", mem);
/* invalid free */
- SetLastError(MAGIC_DEAD);
- mem = GlobalFree(gbl);
+ if (sizeof(void *) != 8) /* crashes on 64-bit Vista */
+ {
- ok(mem == gbl, "Expected gbl, got %p\n", mem);
- ok(GetLastError() == ERROR_INVALID_HANDLE,
- "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+ SetLastError(MAGIC_DEAD);
+ mem = GlobalFree(gbl);
+ ok(mem == gbl || broken(mem == NULL) /* nt4 */, "Expected gbl, got %p\n", mem);
+ if (mem == gbl)
+ ok(GetLastError() == ERROR_INVALID_HANDLE ||
+ GetLastError() == ERROR_INVALID_PARAMETER, /* win9x */
+ "Expected ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ }
gbl = GlobalAlloc(GMEM_DDESHARE, 100);
res = GlobalUnlock(gbl);
- ok(res == 1, "Expected 1, got %d\n", res);
+ ok(res == 1 ||
+ res == 0, /* win9x */
+ "Expected 1 or 0, got %d\n", res);
res = GlobalUnlock(gbl);
- ok(res == 1, "Expected 1, got %d\n", res);
+ ok(res == 1 ||
+ res == 0, /* win9x */
+ "Expected 1 or 0, got %d\n", res);
/* GlobalSize on an invalid handle */
- SetLastError(MAGIC_DEAD);
- size = GlobalSize((HGLOBAL)0xc042);
- ok(size == 0, "Expected 0, got %ld\n", size);
+ if (sizeof(void *) != 8) /* crashes on 64-bit Vista */
+ {
- ok(GetLastError() == ERROR_INVALID_HANDLE,
- "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+ SetLastError(MAGIC_DEAD);
+ size = GlobalSize((HGLOBAL)0xc042);
+ ok(size == 0, "Expected 0, got %ld\n", size);
+ ok(GetLastError() == ERROR_INVALID_HANDLE ||
+ GetLastError() == ERROR_INVALID_PARAMETER, /* win9x */
+ "Expected ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ }
+
+ GlobalFree(gbl);
/* ####################################### */
/* Local*() functions */
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="kernel32_winetest" type="win32cui" installbase="bin" installname="kernel32_winetest.exe" allowwarnings="true">
- <include base="kernel32_winetest">.</include>
+ <include base="kernel32_winetest">.</include>
- <define name="__USE_W32API" />
- <define name="_WIN32_WINNT">0x0600</define>
- <define name="WINVER">0x609</define>
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
+ <library>ntdll</library>
- <library>kernel32</library>
+ <library>user32</library>
- <library>advapi32</library>
- <file>actctx.c</file>
- <file>alloc.c</file>
- <file>atom.c</file>
- <file>change.c</file>
- <file>codepage.c</file>
- <file>comm.c</file>
- <file>console.c</file>
- <file>debugger.c</file>
- <file>directory.c</file>
- <file>drive.c</file>
- <file>environ.c</file>
- <file>file.c</file>
- <file>format_msg.c</file>
- <!-- <file>generated.c</file> -->
- <file>heap.c</file>
- <file>interlck.c</file>
- <file>loader.c</file>
- <file>locale.c</file>
- <file>mailslot.c</file>
- <file>module.c</file>
- <file>path.c</file>
- <file>pipe.c</file>
- <file>process.c</file>
- <file>profile.c</file>
- <file>resource.c</file>
- <file>sync.c</file>
- <file>thread.c</file>
- <file>time.c</file>
- <file>timer.c</file>
- <file>toolhelp.c</file>
- <file>version.c</file>
- <file>virtual.c</file>
- <file>volume.c</file>
- <file>testlist.c</file>
+ <library>advapi32</library>
+ <file>actctx.c</file>
+ <file>alloc.c</file>
+ <file>atom.c</file>
+ <file>change.c</file>
+ <file>codepage.c</file>
+ <file>comm.c</file>
+ <file>console.c</file>
+ <file>debugger.c</file>
+ <file>directory.c</file>
+ <file>drive.c</file>
+ <file>environ.c</file>
+ <file>file.c</file>
+ <file>format_msg.c</file>
+ <!-- <file>generated.c</file> -->
+ <file>heap.c</file>
+ <file>interlck.c</file>
+ <file>loader.c</file>
+ <file>locale.c</file>
+ <file>mailslot.c</file>
+ <file>module.c</file>
+ <file>path.c</file>
+ <file>pipe.c</file>
+ <file>process.c</file>
+ <file>profile.c</file>
+ <file>resource.c</file>
+ <file>sync.c</file>
+ <file>thread.c</file>
+ <file>time.c</file>
+ <file>timer.c</file>
+ <file>toolhelp.c</file>
+ <file>version.c</file>
+ <file>virtual.c</file>
+ <file>volume.c</file>
+ <file>testlist.c</file>
</module>
- </group>
ret = GetDateFormatW(LOCALE_SYSTEM_DEFAULT, DATE_LONGDATE, NULL,
input, buffer, COUNTOF(buffer));
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- return;
+ {
+ win_skip("GetDateFormatW is not implemented\n");
- EXPECT_FLAGS; EXPECT_LEN(0); EXPECT_EQW;
+ return;
+ }
+ ok(!ret && GetLastError() == ERROR_INVALID_FLAGS,
+ "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
+ EXPECT_EQW;
STRINGSW("",""); /* NULL buffer, len > 0 */
SetLastError(0xdeadbeef);
ok (ret == 0, "lstrcmpA(\"\", \"\") should return 0, got %d\n", ret);
ret = lstrcmpA(NULL, NULL);
- ok (ret == 0, "lstrcmpA(NULL, NULL) should return 0, got %d\n", ret);
+ ok (ret == 0 || broken(ret == -2) /* win9x */, "lstrcmpA(NULL, NULL) should return 0, got %d\n", ret);
ret = lstrcmpA("", NULL);
- ok (ret == 1, "lstrcmpA(\"\", NULL) should return 1, got %d\n", ret);
+ ok (ret == 1 || broken(ret == -2) /* win9x */, "lstrcmpA(\"\", NULL) should return 1, got %d\n", ret);
ret = lstrcmpA(NULL, "");
- ok (ret == -1, "lstrcmpA(NULL, \"\") should return -1, got %d\n", ret);
+ ok (ret == -1 || broken(ret == -2) /* win9x */, "lstrcmpA(NULL, \"\") should return -1, got %d\n", ret);
-
+
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"EndDialog",-1,"_Property",-1);
ok( ret == 3, "EndDialog vs _Property ... expected 3, got %d\n", ret);
upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
- trace("Skipping LCMapStringW tests on Win9x\n");
+ win_skip("LCMapStringW is not implemented\n");
return;
}
- ok(!ret, "LCMAP_LOWERCASE and LCMAP_UPPERCASE are mutually exclusive\n");
- ok(GetLastError() == ERROR_INVALID_FLAGS,
- "unexpected error code %d\n", GetLastError());
+ if (broken(ret))
+ ok(lstrcmpW(buf, upper_case) == 0, "Expected upper case string\n");
+ else
+ {
+ ok(!ret, "LCMAP_LOWERCASE and LCMAP_UPPERCASE are mutually exclusive\n");
+ ok(GetLastError() == ERROR_INVALID_FLAGS,
+ "unexpected error code %d\n", GetLastError());
+ }
ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_HIRAGANA | LCMAP_KATAKANA,
upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
/* MAP_FOLDDIGITS */
SetLastError(0);
ret = pFoldStringA(MAP_FOLDDIGITS, digits_src, -1, dst, 256);
- if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("FoldStringA is not implemented\n");
return;
- EXPECT_LEN(4); EXPECT_VALID;
+ }
+ ok(ret == 4, "Expected ret == 4, got %d, error %d\n", ret, GetLastError());
ok(strcmp(dst, digits_dst) == 0,
"MAP_FOLDDIGITS: Expected '%s', got '%s'\n", digits_dst, dst);
for (i = 1; i < 256; i++)
src[1] = '\0';
SetLastError(0);
ret = pFoldStringA(MAP_EXPAND_LIGATURES, src, -1, dst, 256);
- EXPECT_LEN(2); EXPECT_VALID;
+ if (ret == 3)
+ {
+ /* Vista */
+ ok((i == 0xDC && lstrcmpA(dst, "UE") == 0) ||
+ (i == 0xFC && lstrcmpA(dst, "ue") == 0),
+ "Got %s for %d\n", dst, i);
+ }
+ else
+ {
+ ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
- ok(dst[0] == src[0],
- "MAP_EXPAND_LIGATURES: Expected '%s', got '%s'\n", src, dst);
- }
+ ok(dst[0] == src[0],
+ "MAP_EXPAND_LIGATURES: Expected '%s', got '%s'\n", src, dst);
}
}
}
++ }
/* MAP_COMPOSITE */
SetLastError(0);
src[1] = '\0';
SetLastError(0);
ret = pFoldStringA(MAP_FOLDCZONE, src, -1, dst, 256);
- EXPECT_LEN(2); EXPECT_VALID;
+ is_special = FALSE;
+ for (j = 0; foldczone_special[j].src != 0 && ! is_special; j++)
+ {
+ if (foldczone_special[j].src == src[0])
+ {
+ ok(ret == 2 || ret == lstrlenA(foldczone_special[j].dst) + 1,
+ "Expected ret == 2 or %d, got %d, error %d\n",
+ lstrlenA(foldczone_special[j].dst) + 1, ret, GetLastError());
+ ok(src[0] == dst[0] || lstrcmpA(foldczone_special[j].dst, dst) == 0,
+ "MAP_FOLDCZONE: string mismatch for 0x%02x\n",
+ (unsigned char)src[0]);
+ is_special = TRUE;
+ }
+ }
+ if (! is_special)
+ {
+ ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
- ok(src[0] == dst[0],
- "MAP_FOLDCZONE: Expected 0x%02x, got 0x%02x\n",
- (unsigned char)src[0], (unsigned char)dst[0]);
- }
+ ok(src[0] == dst[0],
+ "MAP_FOLDCZONE: Expected 0x%02x, got 0x%02x\n",
+ (unsigned char)src[0], (unsigned char)dst[0]);
+ }
+ }
/* MAP_PRECOMPOSED */
for (i = 1; i < 256; i++)
}
/* MAP_FOLDCZONE */
- for (ch = 1; ch <0xffff; ch++)
- {
- WCHAR expected = 0;
-
- if (ch >= 0xF900 && ch <= 0xFA2F)
- expected = compat_F900_FA2F[ch - 0xF900];
- else if (ch >= 0xFE30 && ch <= 0xFEF7)
- expected = compat_FE30_FEF7[ch - 0xFE30];
- else if (ch >= 0xFF00 && ch <= 0xFFEF)
- expected = compat_FF00_FFEF[ch - 0xFF00];
-
- if (!expected)
- expected = ch;
-
- SetLastError(0);
+ SetLastError(0);
- src[0] = ch;
- src[1] = dst[0] = '\0';
- ret = pFoldStringW(MAP_FOLDCZONE, src, -1, dst, 256);
- EXPECT_LEN(2); EXPECT_VALID;
- ok(dst[0] == expected ||
- /* Wine (correctly) uses updated mappings for some Unicode 4.0 chars */
- /* FIXME: But they should be re-checked */
- ch == 0xf92c || ch == 0xf979 || ch == 0xf995 || ch == 0xf9e7 ||
- ch == 0xf9f1 ||
- (0xfa0c <= ch && ch <= 0xfa6a) ||
- (0xfa70 <= ch && ch <= 0xfad9) ||
- ch == 0xfe47 || ch == 0xfe48 || ch == 0xfe68 ||
- (0xfe70 <= ch && ch <= 0xfe7f) ||
- ch == 0xff3c || ch == 0xff5f || ch == 0xff60 ||
- ch == 0xff9e || ch == 0xff9f,
- "MAP_FOLDCZONE: ch %d 0x%04x Expected 0x%04x got 0x%04x\n",
- ch, ch, expected, dst[0]);
- }
+ ret = pFoldStringW(MAP_FOLDCZONE, foldczone_src, -1, dst, 256);
+ ok(ret == sizeof(foldczone_dst)/sizeof(foldczone_dst[0]),
+ "Got %d, error %d\n", ret, GetLastError());
+ ok(!memcmp(dst, foldczone_dst, sizeof(foldczone_dst)),
+ "MAP_FOLDCZONE: Expanded incorrectly\n");
/* MAP_EXPAND_LIGATURES */
SetLastError(0);
ret = pFoldStringW(MAP_EXPAND_LIGATURES, ligatures_src, -1, dst, 256);
/* NT 4.0 doesn't support MAP_EXPAND_LIGATURES */
if (!(ret == 0 && GetLastError() == ERROR_INVALID_FLAGS)) {
- EXPECT_LEN(sizeof(ligatures_dst)/sizeof(ligatures_dst[0])); EXPECT_VALID;
+ ok(ret == sizeof(ligatures_dst)/sizeof(ligatures_dst[0]),
+ "Got %d, error %d\n", ret, GetLastError());
ok(!memcmp(dst, ligatures_dst, sizeof(ligatures_dst)),
"MAP_EXPAND_LIGATURES: Expanded incorrectly\n");
- for (i = 1; i <= 0xffff; i++)
- {
- if (!strchrW(ligatures_src, i))
- {
- src[0] = i;
- src[1] = '\0';
- SetLastError(0);
- ret = pFoldStringW(MAP_EXPAND_LIGATURES, src, -1, dst, 256);
- EXPECT_LEN(2); EXPECT_VALID;
- ok(dst[0] == src[0],
- "MAP_EXPAND_LIGATURES: 0x%02x : Expected 0x%02x, got 0x%02x\n",
- i, src[0], dst[0]);
- }
+ }
- }
- }
/* FIXME: MAP_PRECOMPOSED : MAP_COMPOSITE */
}
trace("EnumDateFormatsA 0\n");
date_fmt_buf[0] = 0;
+ SetLastError(0xdeadbeef);
ret = EnumDateFormatsA(enum_datetime_procA, lcid, 0);
- ok(ret, "EnumDateFormatsA(0) error %d\n", GetLastError());
- trace("%s\n", date_fmt_buf);
- /* test the 1st enumerated format */
- if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
- ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
- ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
- ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
+ if (!ret && (GetLastError() == ERROR_INVALID_FLAGS))
+ {
+ win_skip("0 for dwFlags is not supported\n");
+ }
+ else
+ {
+ ok(ret, "EnumDateFormatsA(0) error %d\n", GetLastError());
+ trace("%s\n", date_fmt_buf);
+ /* test the 1st enumerated format */
+ if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
+ ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
+ ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
+ ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
+ }
trace("EnumDateFormatsA LOCALE_USE_CP_ACP\n");
date_fmt_buf[0] = 0;
+ SetLastError(0xdeadbeef);
ret = EnumDateFormatsA(enum_datetime_procA, lcid, LOCALE_USE_CP_ACP);
- ok(ret, "EnumDateFormatsA(LOCALE_USE_CP_ACP) error %d\n", GetLastError());
- trace("%s\n", date_fmt_buf);
- /* test the 1st enumerated format */
- if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
- ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
- ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
- ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
+ if (!ret && (GetLastError() == ERROR_INVALID_FLAGS))
+ {
+ win_skip("LOCALE_USE_CP_ACP is not supported\n");
+ }
+ else
+ {
+ ok(ret, "EnumDateFormatsA(LOCALE_USE_CP_ACP) error %d\n", GetLastError());
+ trace("%s\n", date_fmt_buf);
+ /* test the 1st enumerated format */
+ if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
+ ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
+ ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
+ ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
+ }
trace("EnumDateFormatsA DATE_SHORTDATE\n");
date_fmt_buf[0] = 0;
SetLastError(0xdeadbeef);
ret = GetCPInfo(CP_UTF7, &cpinfo);
- ok(ret, "GetCPInfo(CP_UTF7) error %u\n", GetLastError());
- ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
- ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
- ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
- ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
- ok(cpinfo.MaxCharSize == 5, "expected 5, got 0x%x\n", cpinfo.MaxCharSize);
+ if (!ret && GetLastError() == ERROR_INVALID_PARAMETER)
+ {
+ skip("Codepage CP_UTF7 is not installed/available\n");
+ }
+ else
+ {
+ ok(ret, "GetCPInfo(CP_UTF7) error %u\n", GetLastError());
+ ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
+ ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
+ ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
+ ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
+ ok(cpinfo.MaxCharSize == 5, "expected 5, got 0x%x\n", cpinfo.MaxCharSize);
+ }
SetLastError(0xdeadbeef);
ret = GetCPInfo(CP_UTF8, &cpinfo);
- ok(ret, "GetCPInfo(CP_UTF8) error %u\n", GetLastError());
- ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
- ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
- ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
- ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
+ if (!ret && GetLastError() == ERROR_INVALID_PARAMETER)
+ {
+ skip("Codepage CP_UTF8 is not installed/available\n");
+ }
+ else
+ {
- ok(cpinfo.MaxCharSize == 4, "expected 5, got 0x%x\n", cpinfo.MaxCharSize);
+ ok(ret, "GetCPInfo(CP_UTF8) error %u\n", GetLastError());
+ ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
+ ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
+ ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
+ ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
- }
+ ok(cpinfo.MaxCharSize == 4 || broken(cpinfo.MaxCharSize == 3) /* win9x */,
+ "expected 4, got %u\n", cpinfo.MaxCharSize);
++}
}
START_TEST(locale)
/* open a mailslot with a null name */
hSlot = CreateMailslot( NULL, 0, 0, NULL );
- ok( hSlot == INVALID_HANDLE_VALUE,
+ ok( hSlot == INVALID_HANDLE_VALUE || broken(hSlot != INVALID_HANDLE_VALUE), /* win9x */
- "Created mailslot with invalid name\n");
+ "Created mailslot with invalid name\n");
+ if (hSlot == INVALID_HANDLE_VALUE)
- ok( GetLastError() == ERROR_PATH_NOT_FOUND,
+ ok( GetLastError() == ERROR_PATH_NOT_FOUND,
"error should be ERROR_PATH_NOT_FOUND\n");
+ else /* succeeds on win9x */
+ CloseHandle( hSlot );
/* valid open, but with wacky parameters ... then check them */
hSlot = CreateMailslot( szmspath, -1, -1, NULL );
"slot write\n");
ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
- /* now try and open the client, but with the wrong sharing mode */
+ /* now try and openthe client, but with the wrong sharing mode */
- hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
+ hWriter = CreateFile(szmspath, GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, NULL);
- ok( hWriter == INVALID_HANDLE_VALUE, "bad sharing mode\n");
- ok( GetLastError() == ERROR_SHARING_VIOLATION,
- "error should be ERROR_SHARING_VIOLATION\n");
+ ok( hWriter != INVALID_HANDLE_VALUE /* vista */ || GetLastError() == ERROR_SHARING_VIOLATION,
+ "error should be ERROR_SHARING_VIOLATION got %p / %u\n", hWriter, GetLastError());
+ if (hWriter != INVALID_HANDLE_VALUE) CloseHandle( hWriter );
/* now open the client with the correct sharing mode */
hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed\n");
sprintf(tmpstr,"%s\\%s",newdir,LONGDIR);
ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed\n");
- bRes = CreateDirectoryA("c:",NULL);
+ sprintf(tmpstr,"%c:", *curDrive);
+ bRes = CreateDirectoryA(tmpstr,NULL);
- ok(!bRes && (GetLastError() == ERROR_ACCESS_DENIED ||
+ ok(!bRes && (GetLastError() == ERROR_ACCESS_DENIED ||
GetLastError() == ERROR_ALREADY_EXISTS),
- "CreateDirectoryA(\"c:\" should have failed (%d)\n", GetLastError());
- bRes = CreateDirectoryA("c:\\",NULL);
+ "CreateDirectoryA(\"%s\" should have failed (%d)\n", tmpstr, GetLastError());
+ sprintf(tmpstr,"%c:\\", *curDrive);
+ bRes = CreateDirectoryA(tmpstr,NULL);
ok(!bRes && (GetLastError() == ERROR_ACCESS_DENIED ||
GetLastError() == ERROR_ALREADY_EXISTS),
- "CreateDirectoryA(\"c:\\\" should have failed (%d)\n", GetLastError());
+ "CreateDirectoryA(\"%s\" should have failed (%d)\n", tmpstr, GetLastError());
sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,SHORTFILE);
hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL,
CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
lstrcpyW(buf, fooW);
len = GetTempPathW(MAX_PATH, buf);
- if (len == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ if (len==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("GetTempPathW is not available\n");
return;
+ }
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
/* test default configuration */
trace("TMP=%s\n", save_TMP);
- strcpy(buf,save_TMP);
- if (buf[strlen(buf)-1]!='\\')
- strcat(buf,"\\");
- test_GetTempPathA(buf);
- test_GetTempPathW(buf);
+ if (save_TMP[0])
+ {
+ strcpy(buf,save_TMP);
+ if (buf[strlen(buf)-1]!='\\')
+ strcat(buf,"\\");
+ test_GetTempPathA(buf);
+ test_GetTempPathW(buf);
+ }
/* TMP=C:\WINDOWS */
GetWindowsDirectoryA(windir, sizeof(windir));
ret = GetTempPath(sizeof(buf), buf);
ok(ret, "GetTempPath error %u\n", GetLastError());
ok(ret < sizeof(buf), "buffer should be %u bytes\n", ret);
- ok(buf[1] == ':', "expected buf[1] == ':' got %c\n", buf[1]);
- ok(buf[strlen(buf)-1] == '\\', "Temporary path (%s) doesn't end in a slash\n", buf);
+ if (buf[0])
+ {
+ ok(buf[1] == ':', "expected buf[1] == ':' got %c\n", buf[1]);
+ ok(buf[strlen(buf)-1] == '\\', "Temporary path (%s) doesn't end in a slash\n", buf);
+ }
memset(buf, 0, sizeof(buf));
SetLastError(0xdeadbeef);
trace("Server calling overlapped ConnectNamedPipe...\n");
success = ConnectNamedPipe(hnp, &oOverlap);
err = GetLastError();
- ok(success || err == ERROR_IO_PENDING
- || err == ERROR_PIPE_CONNECTED, "overlapped ConnectNamedPipe\n");
+ ok(!success && (err == ERROR_IO_PENDING || err == ERROR_PIPE_CONNECTED), "overlapped ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe returned.\n");
- if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait)
- ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ConnectNamedPipe\n");
+ if (!success && (err == ERROR_IO_PENDING)) {
+ if (letWFSOEwait)
+ {
+ DWORD ret;
+ do {
+ ret = WaitForSingleObjectEx(hEvent, INFINITE, TRUE);
+ } while (ret == WAIT_IO_COMPLETION);
+ ok(ret == 0, "wait ConnectNamedPipe returned %x\n", ret);
+ }
- success = GetOverlappedResult(hnp, &oOverlap, &dummy, letGORwait);
- if (!letGORwait && !letWFSOEwait && !success) {
- ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
- success = GetOverlappedResult(hnp, &oOverlap, &dummy, TRUE);
- }
+ success = GetOverlappedResult(hnp, &oOverlap, &dummy, letGORwait);
+ if (!letGORwait && !letWFSOEwait && !success) {
+ ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
+ success = GetOverlappedResult(hnp, &oOverlap, &dummy, TRUE);
+ }
- ok(success, "GetOverlappedResult ConnectNamedPipe\n");
+ }
+ ok(success || (err == ERROR_PIPE_CONNECTED), "GetOverlappedResult ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe operation complete.\n");
/* Echo bytes once */
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped ReadFile\n");
trace("overlapped ReadFile returned.\n");
- if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait)
- ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ReadFile\n");
+ if (!success && (err == ERROR_IO_PENDING)) {
+ if (letWFSOEwait)
+ {
+ DWORD ret;
+ do {
+ ret = WaitForSingleObjectEx(hEvent, INFINITE, TRUE);
+ } while (ret == WAIT_IO_COMPLETION);
+ ok(ret == 0, "wait ReadFile returned %x\n", ret);
+ }
- success = GetOverlappedResult(hnp, &oOverlap, &readden, letGORwait);
- if (!letGORwait && !letWFSOEwait && !success) {
- ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
- success = GetOverlappedResult(hnp, &oOverlap, &readden, TRUE);
- }
+ success = GetOverlappedResult(hnp, &oOverlap, &readden, letGORwait);
+ if (!letGORwait && !letWFSOEwait && !success) {
+ ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
+ success = GetOverlappedResult(hnp, &oOverlap, &readden, TRUE);
+ }
+ }
trace("Server done reading.\n");
ok(success, "overlapped ReadFile\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped WriteFile\n");
trace("overlapped WriteFile returned.\n");
- if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait)
- ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait WriteFile\n");
+ if (!success && (err == ERROR_IO_PENDING)) {
+ if (letWFSOEwait)
+ {
+ DWORD ret;
+ do {
+ ret = WaitForSingleObjectEx(hEvent, INFINITE, TRUE);
+ } while (ret == WAIT_IO_COMPLETION);
+ ok(ret == 0, "wait WriteFile returned %x\n", ret);
+ }
- success = GetOverlappedResult(hnp, &oOverlap, &written, letGORwait);
- if (!letGORwait && !letWFSOEwait && !success) {
- ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
- success = GetOverlappedResult(hnp, &oOverlap, &written, TRUE);
- }
+ success = GetOverlappedResult(hnp, &oOverlap, &written, letGORwait);
+ if (!letGORwait && !letWFSOEwait && !success) {
+ ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
+ success = GetOverlappedResult(hnp, &oOverlap, &written, TRUE);
+ }
+ }
trace("Server done writing.\n");
ok(success, "overlapped WriteFile\n");
ok(written == readden, "write file len\n");
childPrintf(hFile, "OutputMode=%ld\n", modeOut);
/* now that we have written all relevant information, let's change it */
- ok(SetConsoleCP(1252), "Setting CP\n");
+ SetLastError(0xdeadbeef);
+ ret = SetConsoleCP(1252);
+ if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("Setting the codepage is not implemented\n");
+ }
+ else
+ {
+ ok(ret, "Setting CP\n");
- ok(SetConsoleOutputCP(1252), "Setting SB CP\n");
+ ok(SetConsoleOutputCP(1252), "Setting SB CP\n");
+ }
+
ret = SetConsoleMode(hConIn, modeIn ^ 1);
ok( ret, "Setting mode (%d)\n", GetLastError());
ret = SetConsoleMode(hConOut, modeOut ^ 1);
okChildString("Arguments", "argvA0", buffer);
release_memory();
assert(DeleteFileA(resfile) != 0);
-
+
+ /* Using AppName */
+ get_file_name(resfile);
+ len = GetFullPathNameA(selfname, MAX_PATH, fullpath, &lpFilePart);
+ assert ( lpFilePart != 0);
+ *(lpFilePart -1 ) = 0;
+ p = strrchr(fullpath, '\\');
+ /* Use exename to avoid buffer containing things like 'C:' */
+ if (p) sprintf(buffer, "..%s/%s", p, exename);
+ else sprintf(buffer, "./%s", exename);
+ sprintf(buffer2, "dummy tests/process.c %s \"a\\\"b\\\\\" c\\\" d", resfile);
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(buffer, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError());
+ /* wait for child to terminate */
+ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
+ /* child process has changed result file, so let profile functions know about it */
+ WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
+ sprintf(buffer, "tests/process.c %s", resfile);
+ okChildString("Arguments", "argvA0", "dummy");
+ okChildString("Arguments", "CommandLineA", buffer2);
+ okChildStringWA("Arguments", "CommandLineW", buffer2);
+ release_memory();
+ assert(DeleteFileA(resfile) != 0);
+
+ if (0) /* Test crashes on NT-based Windows. */
+ {
+ /* Test NULL application name and command line parameters. */
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(NULL, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
- }
++}
+
+ buffer[0] = '\0';
+
+ /* Test empty application name parameter. */
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(buffer, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_PATH_NOT_FOUND ||
+ broken(GetLastError() == ERROR_FILE_NOT_FOUND) /* Win9x/WinME */ ||
+ broken(GetLastError() == ERROR_ACCESS_DENIED) /* Win98 */,
+ "Expected ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
+
+ buffer2[0] = '\0';
+
+ /* Test empty application name and command line parameters. */
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(buffer, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_PATH_NOT_FOUND ||
+ broken(GetLastError() == ERROR_FILE_NOT_FOUND) /* Win9x/WinME */ ||
+ broken(GetLastError() == ERROR_ACCESS_DENIED) /* Win98 */,
+ "Expected ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
+
+ /* Test empty command line parameter. */
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(NULL, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
+ GetLastError() == ERROR_PATH_NOT_FOUND /* NT4 */ ||
+ GetLastError() == ERROR_BAD_PATHNAME /* Win98 */ ||
+ GetLastError() == ERROR_INVALID_PARAMETER /* Win7 */,
+ "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+
+ strcpy(buffer, "doesnotexist.exe");
+ strcpy(buffer2, "does not exist.exe");
+
+ /* Test nonexistent application name. */
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(buffer, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(buffer2, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+
+ /* Test nonexistent command line parameter. */
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = CreateProcessA(NULL, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+ ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
}
static void test_Directory(void)
okChildInt("Console", "InputMode", modeIn);
okChildInt("Console", "OutputMode", modeOut);
- ok(cpInC == 1252, "Wrong console CP (expected 1252 got %d/%d)\n", cpInC, cpIn);
- ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %d/%d)\n", cpOutC, cpOut);
+ if (run_tests)
+ {
+ ok(cpInC == 1252, "Wrong console CP (expected 1252 got %d/%d)\n", cpInC, cpIn);
+ ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %d/%d)\n", cpOutC, cpOut);
+ }
+ else
+ win_skip("Setting the codepage is not implemented\n");
+
ok(modeInC == (modeIn ^ 1), "Wrong console mode\n");
ok(modeOutC == (modeOut ^ 1), "Wrong console-SB mode\n");
trace("cursor position(X): %d/%d\n",sbi.dwCursorPosition.X, sbiC.dwCursorPosition.X);
CloseHandle( h);
/* Test with sufficiently large buffer */
+ memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 29, testfile3 );
- ok( ret == 27, "expected return size 27, got %d\n", ret );
- ok( buf[ret-1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
+ ok( ret == 27 ||
+ broken(ret == 28), /* Win9x, WinME */
+ "expected return size 27, got %d\n", ret );
+ ok( (buf[ret-1] == 0 && buf[ret] == 0) ||
+ broken(buf[ret-1] == 0 && buf[ret-2] == 0), /* Win9x, WinME */
+ "returned buffer not terminated with double-null\n" );
-
+
/* Test with exactly fitting buffer */
+ memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 28, testfile3 );
- ok( ret == 26, "expected return size 26, got %d\n", ret );
- ok( buf[ret+1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
+ ok( ret == 26 ||
+ broken(ret == 28), /* Win9x, WinME */
+ "expected return size 26, got %d\n", ret );
+ todo_wine
+ ok( (buf[ret+1] == 0 && buf[ret] == 0) || /* W2K3 and higher */
+ broken(buf[ret+1] == 0xc && buf[ret] == 0) || /* NT4, W2K, WinXP */
+ broken(buf[ret-1] == 0 && buf[ret-2] == 0), /* Win9x, WinME */
+ "returned buffer not terminated with double-null\n" );
-
+
/* Test with a buffer too small */
+ memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 27, testfile3 );
ok( ret == 25, "expected return size 25, got %d\n", ret );
- ok( buf[ret+1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
+ /* Win9x and WinME only fills the buffer with complete section names (double-null terminated) */
+ count = strlen("section1") + sizeof(CHAR) + strlen("section2");
+ todo_wine
+ ok( (buf[ret+1] == 0 && buf[ret] == 0) ||
+ broken(buf[count] == 0 && buf[count+1] == 0), /* Win9x, WinME */
+ "returned buffer not terminated with double-null\n" );
-
+
/* Tests on nonexistent file */
- memset(buf, 0xcc, sizeof(buf));
+ memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 10, ".\\not_here.ini" );
- ok( ret == 0, "expected return size 0, got %d\n", ret );
+ ok( ret == 0 ||
+ broken(ret == 1), /* Win9x, WinME */
+ "expected return size 0, got %d\n", ret );
ok( buf[0] == 0, "returned buffer not terminated with null\n" );
ok( buf[1] != 0, "returned buffer terminated with double-null\n" );
ok( bufW[ret-1] == 0 && bufW[ret] == 0, "returned buffer not terminated with double-null\n" );
/* Test with exactly fitting buffer */
+ memset(bufW, 0xcc, sizeof(bufW));
ret = GetPrivateProfileSectionNamesW( bufW, 28, testfile3W );
ok( ret == 26, "expected return size 26, got %d\n", ret );
- ok( bufW[ret+1] == 0 && bufW[ret] == 0, "returned buffer not terminated with double-null\n" );
+ ok( (bufW[ret+1] == 0 && bufW[ret] == 0) || /* W2K3 and higher */
+ broken(bufW[ret+1] == 0xcccc && bufW[ret] == 0), /* NT4, W2K, WinXP */
+ "returned buffer not terminated with double-null\n" );
-
+
/* Test with a buffer too small */
+ memset(bufW, 0xcc, sizeof(bufW));
ret = GetPrivateProfileSectionNamesW( bufW, 27, testfile3W );
ok( ret == 25, "expected return size 25, got %d\n", ret );
ok( bufW[ret+1] == 0 && bufW[ret] == 0, "returned buffer not terminated with double-null\n" );
CloseHandle( file );
res = BeginUpdateResource( filename, TRUE );
- ok( res != NULL, "BeginUpdateResource failed\n");
+ if ( res != NULL || GetLastError() != ERROR_FILE_INVALID )
+ {
+ ok( res != NULL, "BeginUpdateResource failed\n");
- /* check if it's possible to open the file now */
- test = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
- ok (test != INVALID_HANDLE_VALUE, "failed to create file\n");
+ /* check if it's possible to open the file now */
+ test = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
+ ok (test != INVALID_HANDLE_VALUE, "failed to create file\n");
- CloseHandle( test );
+ CloseHandle( test );
- r = EndUpdateResource( res, FALSE );
- ok( r == FALSE, "EndUpdateResource failed\n");
+ r = EndUpdateResource( res, FALSE );
+ ok( r == FALSE, "EndUpdateResource failed\n");
+ }
+ else
+ skip( "Can't update resource in empty file\n" );
res = BeginUpdateResource( filename, FALSE );
ok( res == NULL, "BeginUpdateResource failed\n");
res = BeginUpdateResource( filename, TRUE );
ok( res != NULL, "BeginUpdateResource failed\n");
- r = UpdateResource( res,
- MAKEINTRESOURCE(0x1230),
- MAKEINTRESOURCE(0x4567),
- 0xabcd,
- NULL, 0 );
- ok( r == FALSE, "UpdateResource failed\n");
+ if (0) /* this causes subsequent tests to fail on Vista */
+ {
+ r = UpdateResource( res,
+ MAKEINTRESOURCE(0x1230),
+ MAKEINTRESOURCE(0x4567),
+ 0xabcd,
+ NULL, 0 );
+ ok( r == FALSE, "UpdateResource failed\n");
+ }
r = UpdateResource( res,
MAKEINTRESOURCE(0x1230),
SetLastError(0xdeadbeef);
rc=pGetThreadPriorityBoost(curthread,&disabled);
if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
- return; /* WinME */
+ {
+ win_skip("GetThreadPriorityBoost is not implemented on WinME\n");
+ return;
+ }
- todo_wine
- ok(rc!=0,"error=%d\n",GetLastError());
+ ok(rc!=0,"error=%d\n",GetLastError());
if (pOpenThread) {
/* check that access control is obeyed */
rc = pSetThreadPriorityBoost(curthread,0);
ok( rc != 0, "error=%d\n",GetLastError());
- rc=pGetThreadPriorityBoost(curthread,&disabled);
- ok(rc!=0 && disabled==0,
- "rc=%d error=%d disabled=%d\n",rc,GetLastError(),disabled);
-}
+ }
- }
+ rc=pGetThreadPriorityBoost(curthread,&disabled);
+ ok(rc!=0 && disabled==0,
+ "rc=%d error=%d disabled=%d\n",rc,GetLastError(),disabled);
+ }
/* check the GetThreadTimes function */
static VOID test_GetThreadTimes(void)
"SetThreadAffinityMask passed for an illegal processor\n");
/* NOTE: This only works on WinNT/2000/XP) */
if (pSetThreadIdealProcessor) {
- todo_wine {
- SetLastError(0);
+ SetLastError(0xdeadbeef);
- error=pSetThreadIdealProcessor(curthread,0);
+ error=pSetThreadIdealProcessor(curthread,0);
- if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
- ok(error!=-1, "SetThreadIdealProcessor failed\n");
- }
+ if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("SetThreadIdealProcessor is not implemented\n");
+ return;
}
- if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
- ok(error!=-1, "SetThreadIdealProcessor failed\n");
++ ok(error!=-1, "SetThreadIdealProcessor failed\n");
+
+ SetLastError(0xdeadbeef);
- error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
- ok(error==-1,
- "SetThreadIdealProcessor succeeded with an illegal processor #\n");
+ error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
+ ok(error==-1,
+ "SetThreadIdealProcessor succeeded with an illegal processor #\n");
- todo_wine {
+ ok(GetLastError()==ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
- error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS);
- ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n");
- }
-}
+ error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS);
+ ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n");
+ }
+ }
- }
- }
static VOID test_GetThreadExitCode(void)
{
{
if (te.th32OwnerProcessID == curr_pid) curr_found++;
if (te.th32OwnerProcessID == sub_pcs_pid) sub_found++;
- trace("PID=%x TID=%x %d\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
+ if (winetest_debug > 1)
+ trace("PID=%x TID=%x %d\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
num++;
} while (pThread32Next( hSnapshot, &te ));
}
{
if (te.th32OwnerProcessID == curr_pid) curr_found++;
if (te.th32OwnerProcessID == sub_pcs_pid) sub_found++;
- trace("PID=%x TID=%x %d\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
+ if (winetest_debug > 1)
+ trace("PID=%x TID=%x %d\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
num--;
} while (pThread32Next( hSnapshot, &te ));
}
ok( mapping != 0, "OpenFileMapping FILE_MAP_READ error %u\n", GetLastError() );
SetLastError(0xdeadbeef);
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
- todo_wine ok( !ptr, "MapViewOfFile FILE_MAP_WRITE should fail\n" );
- todo_wine ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
+ if (!ptr)
+ {
+ ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
- SetLastError(0xdeadbeef);
- ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
- ok( ptr != NULL, "MapViewOfFile FILE_MAP_READ error %u\n", GetLastError() );
- SetLastError(0xdeadbeef);
- ok( VirtualQuery( ptr, &info, sizeof(info) ) == sizeof(info),
- "VirtualQuery error %u\n", GetLastError() );
- ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
- ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
+ SetLastError(0xdeadbeef);
+ ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
+ ok( ptr != NULL, "MapViewOfFile FILE_MAP_READ error %u\n", GetLastError() );
+ SetLastError(0xdeadbeef);
+ ok( VirtualQuery( ptr, &info, sizeof(info) ) == sizeof(info),
+ "VirtualQuery error %u\n", GetLastError() );
+ ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
+ ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
- todo_wine ok( info.AllocationProtect == PAGE_READONLY, "%x != PAGE_READONLY\n", info.AllocationProtect );
+ ok( info.AllocationProtect == PAGE_READONLY, "%x != PAGE_READONLY\n", info.AllocationProtect );
- ok( info.RegionSize == 4096, "%lx != 4096\n", info.RegionSize );
- ok( info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State );
+ ok( info.RegionSize == 4096, "%lx != 4096\n", info.RegionSize );
+ ok( info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State );
- todo_wine ok( info.Protect == PAGE_READONLY, "%x != PAGE_READONLY\n", info.Protect );
+ ok( info.Protect == PAGE_READONLY, "%x != PAGE_READONLY\n", info.Protect );
+ }
+ else win_skip( "no access checks on win9x\n" );
UnmapViewOfFile( ptr );
CloseHandle( mapping );
ok( mapping != 0, "OpenFileMapping FILE_MAP_WRITE error %u\n", GetLastError() );
SetLastError(0xdeadbeef);
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
- todo_wine ok( !ptr, "MapViewOfFile FILE_MAP_READ should fail\n" );
- todo_wine ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
+ if (!ptr)
+ {
+ ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
- SetLastError(0xdeadbeef);
- ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
- ok( ptr != NULL, "MapViewOfFile FILE_MAP_WRITE error %u\n", GetLastError() );
- SetLastError(0xdeadbeef);
- ok( VirtualQuery( ptr, &info, sizeof(info) ) == sizeof(info),
- "VirtualQuery error %u\n", GetLastError() );
- ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
- ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
- ok( info.AllocationProtect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.AllocationProtect );
- ok( info.RegionSize == 4096, "%lx != 4096\n", info.RegionSize );
- ok( info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State );
- ok( info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect );
+ SetLastError(0xdeadbeef);
+ ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
+ ok( ptr != NULL, "MapViewOfFile FILE_MAP_WRITE error %u\n", GetLastError() );
+ SetLastError(0xdeadbeef);
+ ok( VirtualQuery( ptr, &info, sizeof(info) ) == sizeof(info),
+ "VirtualQuery error %u\n", GetLastError() );
+ ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
+ ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
+ ok( info.AllocationProtect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.AllocationProtect );
+ ok( info.RegionSize == 4096, "%lx != 4096\n", info.RegionSize );
+ ok( info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State );
+ ok( info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect );
+ }
+ else win_skip( "no access checks on win9x\n" );
UnmapViewOfFile( ptr );
CloseHandle( mapping );
ok(ret, "VirtualQuery failed with error %d\n", GetLastError());
ok(info.BaseAddress == ptr, "BaseAddress should have been %p but was %p instead\n", ptr, info.BaseAddress);
ok(info.AllocationBase == ptr, "AllocationBase should have been %p but was %p instead\n", ptr, info.AllocationBase);
- ok(info.AllocationProtect == PAGE_READWRITE, "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
ok(info.RegionSize == MAPPING_SIZE, "RegionSize should have been 0x%x but was 0x%x\n", MAPPING_SIZE, (unsigned int)info.RegionSize);
- todo_wine
ok(info.State == MEM_RESERVE, "State should have been MEM_RESERVE instead of 0x%x\n", info.State);
- todo_wine
+ if (info.Type == MEM_PRIVATE) /* win9x is different for uncommitted mappings */
+ {
+ ok(info.AllocationProtect == PAGE_NOACCESS,
+ "AllocationProtect should have been PAGE_NOACCESS but was 0x%x\n", info.AllocationProtect);
+ ok(info.Protect == PAGE_NOACCESS,
+ "Protect should have been PAGE_NOACCESS instead of 0x%x\n", info.Protect);
+ }
+ else
+ {
+ ok(info.AllocationProtect == PAGE_READWRITE,
+ "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
- ok(info.Protect == 0, "Protect should have been 0 instead of 0x%x\n", info.Protect);
- ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
+ ok(info.Protect == 0, "Protect should have been 0 instead of 0x%x\n", info.Protect);
+ ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
+ }
- ptr = VirtualAlloc(ptr, 0x10000, MEM_COMMIT, PAGE_READWRITE);
+ if (ptr != ptr2)
+ {
+ ret = VirtualQuery(ptr2, &info, sizeof(info));
+ ok(ret, "VirtualQuery failed with error %d\n", GetLastError());
+ ok(info.BaseAddress == ptr2,
+ "BaseAddress should have been %p but was %p instead\n", ptr2, info.BaseAddress);
+ ok(info.AllocationBase == ptr2,
+ "AllocationBase should have been %p but was %p instead\n", ptr2, info.AllocationBase);
+ ok(info.AllocationProtect == PAGE_READWRITE,
+ "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
+ ok(info.RegionSize == MAPPING_SIZE,
+ "RegionSize should have been 0x%x but was 0x%x\n", MAPPING_SIZE, (unsigned int)info.RegionSize);
+ ok(info.State == MEM_RESERVE,
+ "State should have been MEM_RESERVE instead of 0x%x\n", info.State);
+ ok(info.Protect == 0,
+ "Protect should have been 0 instead of 0x%x\n", info.Protect);
+ ok(info.Type == MEM_MAPPED,
+ "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
+ }
+
+ ptr = VirtualAlloc(ptr, 0x10000, MEM_COMMIT, PAGE_READONLY);
ok(ptr != NULL, "VirtualAlloc failed with error %d\n", GetLastError());
ret = VirtualQuery(ptr, &info, sizeof(info));
ok(ret, "VirtualQuery failed with error %d\n", GetLastError());
ok(info.BaseAddress == ptr, "BaseAddress should have been %p but was %p instead\n", ptr, info.BaseAddress);
ok(info.AllocationBase == ptr, "AllocationBase should have been %p but was %p instead\n", ptr, info.AllocationBase);
- ok(info.AllocationProtect == PAGE_READWRITE, "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
- todo_wine
ok(info.RegionSize == 0x10000, "RegionSize should have been 0x10000 but was 0x%x\n", (unsigned int)info.RegionSize);
ok(info.State == MEM_COMMIT, "State should have been MEM_RESERVE instead of 0x%x\n", info.State);
- ok(info.Protect == PAGE_READWRITE, "Protect should have been 0 instead of 0x%x\n", info.Protect);
+ ok(info.Protect == PAGE_READONLY, "Protect should have been 0 instead of 0x%x\n", info.Protect);
+ if (info.Type == MEM_PRIVATE) /* win9x is different for uncommitted mappings */
+ {
+ ok(info.AllocationProtect == PAGE_NOACCESS,
+ "AllocationProtect should have been PAGE_NOACCESS but was 0x%x\n", info.AllocationProtect);
+ }
+ else
+ {
+ ok(info.AllocationProtect == PAGE_READWRITE,
+ "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
- ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
+ ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
-
- ptr2 = MapViewOfFile(mapping, FILE_MAP_WRITE, 0, 0, 0);
- /* on NT ptr != ptr2 but on Win9x ptr == ptr2 */
- ok(ptr2 != NULL, "MapViewOfFile failed with error %d\n", GetLastError());
- trace("mapping same section resulted in views %p and %p\n", ptr, ptr2);
+ }
/* shows that the VirtualAlloc above affects the mapping, not just the
* virtual memory in this process - it also affects all other processes
* with a view of the mapping, but that isn't tested here */
- ret = VirtualQuery(ptr2, &info, sizeof(info));
- ok(ret, "VirtualQuery failed with error %d\n", GetLastError());
+ if (ptr != ptr2)
+ {
- ok(info.BaseAddress == ptr2, "BaseAddress should have been %p but was %p instead\n", ptr2, info.BaseAddress);
- ok(info.AllocationBase == ptr2, "AllocationBase should have been %p but was %p instead\n", ptr2, info.AllocationBase);
- ok(info.AllocationProtect == PAGE_READWRITE, "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
- todo_wine
- ok(info.RegionSize == 0x10000, "RegionSize should have been 0x10000 but was 0x%x\n", (unsigned int)info.RegionSize);
- ok(info.State == MEM_COMMIT, "State should have been MEM_RESERVE instead of 0x%x\n", info.State);
- ok(info.Protect == PAGE_READWRITE, "Protect should have been 0 instead of 0x%x\n", info.Protect);
+ ret = VirtualQuery(ptr2, &info, sizeof(info));
+ ok(ret, "VirtualQuery failed with error %d\n", GetLastError());
- ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
+ ok(info.BaseAddress == ptr2,
+ "BaseAddress should have been %p but was %p instead\n", ptr2, info.BaseAddress);
+ ok(info.AllocationBase == ptr2,
+ "AllocationBase should have been %p but was %p instead\n", ptr2, info.AllocationBase);
+ ok(info.AllocationProtect == PAGE_READWRITE,
+ "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n", info.AllocationProtect);
+ ok(info.RegionSize == 0x10000,
+ "RegionSize should have been 0x10000 but was 0x%x\n", (unsigned int)info.RegionSize);
+ ok(info.State == MEM_COMMIT,
+ "State should have been MEM_RESERVE instead of 0x%x\n", info.State);
+ ok(info.Protect == PAGE_READWRITE,
+ "Protect should have been 0 instead of 0x%x\n", info.Protect);
+ ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
+ }
+
+ addr = VirtualAlloc( ptr, MAPPING_SIZE, MEM_RESET, PAGE_READONLY );
+ ok( addr == ptr || broken(!addr && GetLastError() == ERROR_INVALID_PARAMETER), /* win9x */
+ "VirtualAlloc failed with error %u\n", GetLastError() );
+
+ ret = VirtualFree( ptr, 0x10000, MEM_DECOMMIT );
+ ok( !ret || broken(ret) /* win9x */, "VirtualFree succeeded\n" );
+ if (!ret)
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "VirtualFree failed with %u\n", GetLastError() );
ret = UnmapViewOfFile(ptr2);
ok(ret, "UnmapViewOfFile failed with error %d\n", GetLastError());
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
- }
+ ok(!strncmp( volume, "\\\\?\\Volume{", 11),
+ "GetVolumeNameForVolumeMountPointA failed to return valid string <%s>\n",
+ volume);
+
+ /* test with too small buffer */
+ ret = pGetVolumeNameForVolumeMountPointA(path, volume, 10);
+ ok(ret == FALSE && GetLastError() == ERROR_FILENAME_EXCED_RANGE,
+ "GetVolumeNameForVolumeMountPointA failed, wrong error returned, was %d, should be ERROR_FILENAME_EXCED_RANGE\n",
+ GetLastError());
+
+ /* Try on a arbitrary directory */
+ ret = pGetVolumeNameForVolumeMountPointA(temp_path, volume, len);
+ ok(ret == FALSE && GetLastError() == ERROR_NOT_A_REPARSE_POINT,
+ "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
+ temp_path, GetLastError());
+
+ /* Try on a nonexistent dos drive */
+ path[2] = 0;
+ for (;path[0] <= 'z'; path[0]++) {
+ ret = QueryDosDeviceA( path, volume, len);
+ if(!ret) break;
++}
+ if (path[0] <= 'z')
+ {
+ path[2] = '\\';
+ ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
+ ok(ret == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND,
+ "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
+ path, GetLastError());
+
+ /* Try without trailing \ and on a nonexistent dos drive */
+ path[2] = 0;
+ ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
+ ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
+ "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
+ path, GetLastError());
+ }
}
static void test_GetVolumeNameForVolumeMountPointW(void)
ret = IEnumCodePage_Reset(iEnumCP);
ok(ret == S_OK, "IEnumCodePage_Reset: expected S_OK, got %08x\n", ret);
n = 65536;
- TRACE_2("Call IEnumCodePage_Next\n");
ret = IEnumCodePage_Next(iEnumCP, 0, NULL, &n);
- ok(n == 0 && ret == S_FALSE, "IEnumCodePage_Next: expected 0/S_FALSE, got %u/%08x\n", n, ret);
+ if (ret == S_FALSE)
- TRACE_2("Call IEnumCodePage_Next\n");
+ ok(n == 0 && ret == S_FALSE, "IEnumCodePage_Next: expected 0/S_FALSE, got %u/%08x\n", n, ret);
+ else if (ret == E_FAIL)
+ ok(n == 65536 && ret == E_FAIL, "IEnumCodePage_Next: expected 65536/E_FAIL, got %u/%08x\n", n, ret);
ret = IEnumCodePage_Next(iEnumCP, 0, NULL, NULL);
- ok(ret == S_FALSE, "IEnumCodePage_Next: expected S_FALSE, got %08x\n", ret);
+ if (ret == S_FALSE)
+ ok(ret == S_FALSE, "IEnumCodePage_Next: expected S_FALSE, got %08x\n", ret);
+ else if (ret == E_FAIL)
+ ok(n == 65536 && ret == E_FAIL, "IEnumCodePage_Next: expected 65536/E_FAIL, got %u/%08x\n", n, ret);
cpinfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*cpinfo) * total * 2);
#endif
ok(cpinfo[i].dwFlags & flags, "enumerated flags %08x do not include requested %08x\n", cpinfo[i].dwFlags, flags);
- if (TranslateCharsetInfo((DWORD *)cpinfo[i].uiFamilyCodePage, &csi, TCI_SRCCODEPAGE))
+ if (TranslateCharsetInfo((DWORD *)(INT_PTR)cpinfo[i].uiFamilyCodePage, &csi, TCI_SRCCODEPAGE))
ok(cpinfo[i].bGDICharset == csi.ciCharset, "%d != %d\n", cpinfo[i].bGDICharset, csi.ciCharset);
else
- trace("TranslateCharsetInfo failed for cp %u\n", cpinfo[i].uiFamilyCodePage);
+ if (winetest_debug > 1)
+ trace("TranslateCharsetInfo failed for cp %u\n", cpinfo[i].uiFamilyCodePage);
+ #ifdef DUMP_CP_INFO
trace("%u: codepage %u family %u\n", i, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
-
+ #endif
/* Win95 does not support UTF-7 */
if (cpinfo[i].uiCodePage == CP_UTF7) continue;
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UNICODE -> %u) = %08x\n", cpinfo[i].uiCodePage, ret);
convertible = check_convertible(iML2, cpinfo[i].uiCodePage, CP_UTF8);
- if (!convertible)
- check = S_FALSE;
-
- TRACE_2("Call IMultiLanguage2_IsConvertible\n");
+ if (convertible != E_FAIL)
+ {
- ret = IMultiLanguage2_IsConvertible(iML2, cpinfo[i].uiCodePage, CP_UTF8);
+ ret = IMultiLanguage2_IsConvertible(iML2, cpinfo[i].uiCodePage, CP_UTF8);
- ok(ret == check, "IMultiLanguage2_IsConvertible(%u -> CP_UTF8) = %08x\n", cpinfo[i].uiCodePage, ret);
- TRACE_2("Call IMultiLanguage2_IsConvertible\n");
+ ok(ret == convertible, "IMultiLanguage2_IsConvertible(%u -> CP_UTF8) = %08x\n", cpinfo[i].uiCodePage, ret);
- ret = IMultiLanguage2_IsConvertible(iML2, CP_UTF8, cpinfo[i].uiCodePage);
+ ret = IMultiLanguage2_IsConvertible(iML2, CP_UTF8, cpinfo[i].uiCodePage);
- ok(ret == check, "IMultiLanguage2_IsConvertible(CP_UTF8 -> %u) = %08x\n", cpinfo[i].uiCodePage, ret);
+ ok(ret == convertible, "IMultiLanguage2_IsConvertible(CP_UTF8 -> %u) = %08x\n", cpinfo[i].uiCodePage, ret);
- }
++ }
}
else
- trace("IsValidCodePage failed for cp %u\n", cpinfo[i].uiCodePage);
+ if (winetest_debug > 1)
+ trace("IsValidCodePage failed for cp %u\n", cpinfo[i].uiCodePage);
- ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszWebCharset, &mcsi);
- /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
- if (memcmp(cpinfo[i].wszWebCharset, autoW, 5 * sizeof(WCHAR)))
- {
- ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08x\n", ret);
+ if (memcmp(cpinfo[i].wszWebCharset,feffW,sizeof(WCHAR)*11)==0)
+ skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
+ else
+ {
+ ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszWebCharset, &mcsi);
+ /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
+ if (memcmp(cpinfo[i].wszWebCharset, autoW, 5 * sizeof(WCHAR)))
+ {
+ ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08x\n", ret);
#ifdef DUMP_CP_INFO
- trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszWebCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
+ trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszWebCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
#endif
- ok(!lstrcmpiW(cpinfo[i].wszWebCharset, mcsi.wszCharset),
+ ok(!lstrcmpiW(cpinfo[i].wszWebCharset, mcsi.wszCharset),
#ifdef DUMP_CP_INFO
- "%s != %s\n",
- wine_dbgstr_w(cpinfo[i].wszWebCharset), wine_dbgstr_w(mcsi.wszCharset));
+ "%s != %s\n",
+ wine_dbgstr_w(cpinfo[i].wszWebCharset), wine_dbgstr_w(mcsi.wszCharset));
#else
- "wszWebCharset mismatch\n");
+ "wszWebCharset mismatch\n");
#endif
- if (0)
- {
- /* native mlang returns completely messed up encodings in some cases */
- ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
- "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
- ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
- "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
- }
+ if (0)
+ {
+ /* native mlang returns completely messed up encodings in some cases */
+ ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
+ "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
+ ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
+ "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
}
+ }
+ }
- ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszHeaderCharset, &mcsi);
- /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
- if (memcmp(cpinfo[i].wszHeaderCharset, autoW, 5 * sizeof(WCHAR)))
- {
- ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08x\n", ret);
+ if (memcmp(cpinfo[i].wszHeaderCharset,feffW,sizeof(WCHAR)*11)==0)
+ skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
+ else
+ {
+ ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszHeaderCharset, &mcsi);
+ /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
+ if (memcmp(cpinfo[i].wszHeaderCharset, autoW, 5 * sizeof(WCHAR)))
+ {
+ ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08x\n", ret);
#ifdef DUMP_CP_INFO
- trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszHeaderCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
+ trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszHeaderCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
#endif
- ok(!lstrcmpiW(cpinfo[i].wszHeaderCharset, mcsi.wszCharset),
+ ok(!lstrcmpiW(cpinfo[i].wszHeaderCharset, mcsi.wszCharset),
#ifdef DUMP_CP_INFO
- "%s != %s\n",
- wine_dbgstr_w(cpinfo[i].wszHeaderCharset), wine_dbgstr_w(mcsi.wszCharset));
+ "%s != %s\n",
+ wine_dbgstr_w(cpinfo[i].wszHeaderCharset), wine_dbgstr_w(mcsi.wszCharset));
#else
- "wszHeaderCharset mismatch\n");
+ "wszHeaderCharset mismatch\n");
#endif
- if (0)
- {
- /* native mlang returns completely messed up encodings in some cases */
- ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
- "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
- ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
- "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
- }
- }
+ if (0)
+ {
+ /* native mlang returns completely messed up encodings in some cases */
+ ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
+ "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
+ ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
+ "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
+ }
+ }
+ }
- ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszBodyCharset, &mcsi);
- /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
- if (memcmp(cpinfo[i].wszBodyCharset, autoW, 5 * sizeof(WCHAR)))
- {
- ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08x\n", ret);
+ if (memcmp(cpinfo[i].wszBodyCharset,feffW,sizeof(WCHAR)*11)==0)
+ skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
+ else
+ {
+ ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszBodyCharset, &mcsi);
+ /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
+ if (memcmp(cpinfo[i].wszBodyCharset, autoW, 5 * sizeof(WCHAR)))
+ {
+ ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08x\n", ret);
#ifdef DUMP_CP_INFO
- trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszBodyCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
+ trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszBodyCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
#endif
- ok(!lstrcmpiW(cpinfo[i].wszBodyCharset, mcsi.wszCharset),
+ ok(!lstrcmpiW(cpinfo[i].wszBodyCharset, mcsi.wszCharset),
#ifdef DUMP_CP_INFO
- "%s != %s\n",
- wine_dbgstr_w(cpinfo[i].wszBodyCharset), wine_dbgstr_w(mcsi.wszCharset));
+ "%s != %s\n",
+ wine_dbgstr_w(cpinfo[i].wszBodyCharset), wine_dbgstr_w(mcsi.wszCharset));
#else
- "wszBodyCharset mismatch\n");
+ "wszBodyCharset mismatch\n");
#endif
- if (0)
- {
- /* native mlang returns completely messed up encodings in some cases */
- ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
- "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
- ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
- "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
- }
- }
+ if (0)
+ {
+ /* native mlang returns completely messed up encodings in some cases */
+ ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
+ "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
+ ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
+ "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
+ }
+ }
}
+ }
/* now IEnumCodePage_Next should fail, since pointer is at the end */
n = 1;
IMLangFontLink_Test(iMLFL);
IMLangFontLink_Release(iMLFL);
-
+
+ /* IMLangFontLink2 */
+ ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IMLangFontLink2, (void **)&iMLFL2);
+ if (ret != S_OK || !iMLFL2) return;
+
+ test_GetScriptFontInfo(iMLFL2);
+ test_GetFontUnicodeRanges(iMLFL2);
+ test_CodePageToScriptID(iMLFL2);
+ IMLangFontLink2_Release(iMLFL2);
+
CoUninitialize();
}
DWORD fdwSupport)
{
MMRESULT rc;
- ACMDRIVERDETAILSA dd;
+ ACMDRIVERDETAILS dd;
HACMDRIVER had;
-
+
DWORD dwDriverPriority;
DWORD dwDriverSupport;
BSTR str;
HRESULT hres;
- hres = IHTMLDocument2_get_selection(doc, &selection);
- ok(hres == S_OK, "get_selection failed: %08x\n", hres);
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle2_get_position(style2, &str);
+ ok(hres == S_OK, "get_position failed: %08x\n", hres);
+ ok(!str, "str != NULL\n");
+
+ str = a2bstr("absolute");
+ hres = IHTMLStyle2_put_position(style2, str);
+ ok(hres == S_OK, "put_position failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = NULL;
+ hres = IHTMLStyle2_get_position(style2, &str);
+ ok(hres == S_OK, "get_position failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+ }
+
+ static void test_style3(IHTMLStyle3 *style3)
+ {
+ BSTR str;
+ HRESULT hres;
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle3_get_wordWrap(style3, &str);
+ ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
+ ok(!str, "str != NULL\n");
+
+ str = a2bstr("break-word");
+ hres = IHTMLStyle3_put_wordWrap(style3, str);
+ ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = NULL;
+ hres = IHTMLStyle3_get_wordWrap(style3, &str);
+ ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+ }
+
+ static void test_style4(IHTMLStyle4 *style4)
+ {
+ HRESULT hres;
+ VARIANT v;
+ VARIANT vdefault;
+
+ hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
+ ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10px");
+ hres = IHTMLStyle4_put_minHeight(style4, v);
+ ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle4_get_minHeight(style4, &v);
+ ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
+ ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
+
+ hres = IHTMLStyle4_put_minHeight(style4, vdefault);
+ ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
+ VariantClear(&vdefault);
+ }
+
+ static void test_default_style(IHTMLStyle *style)
+ {
+ IHTMLStyle2 *style2;
+ IHTMLStyle3 *style3;
+ IHTMLStyle4 *style4;
+ VARIANT_BOOL b;
+ VARIANT v;
+ BSTR str;
+ HRESULT hres;
+ float f;
+ BSTR sOverflowDefault;
+ BSTR sDefault;
+ VARIANT vDefault;
+
+ test_disp((IUnknown*)style, &DIID_DispHTMLStyle, "[object]");
+ test_ifaces((IUnknown*)style, style_iids);
+
+ test_style_csstext(style, NULL);
+
+ hres = IHTMLStyle_get_position(style, &str);
+ ok(hres == S_OK, "get_position failed: %08x\n", hres);
+ ok(!str, "str=%s\n", wine_dbgstr_w(str));
+
+ V_VT(&v) = VT_NULL;
+ hres = IHTMLStyle_get_marginRight(style, &v);
+ ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+
+ V_VT(&v) = VT_NULL;
+ hres = IHTMLStyle_get_marginLeft(style, &v);
+ ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_fontFamily(style, &str);
+ ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
+ ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_fontWeight(style, &str);
+ ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
+ ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
+
+ hres = IHTMLStyle_get_fontWeight(style, &sDefault);
+ ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
+
+ str = a2bstr("test");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("bold");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("bolder");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("lighter");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("100");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("200");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("300");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("400");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("500");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("600");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("700");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("800");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("900");
+ hres = IHTMLStyle_put_fontWeight(style, str);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_fontWeight(style, &str);
+ ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "900"), "str != style900\n");
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_fontWeight(style, sDefault);
+ ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* font Variant */
+ hres = IHTMLStyle_get_fontVariant(style, NULL);
+ ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_fontVariant(style, &sDefault);
+ ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
+
+ str = a2bstr("test");
+ hres = IHTMLStyle_put_fontVariant(style, str);
+ ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("small-caps");
+ hres = IHTMLStyle_put_fontVariant(style, str);
+ ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("normal");
+ hres = IHTMLStyle_put_fontVariant(style, str);
+ ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_fontVariant(style, sDefault);
+ ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_display(style, &str);
+ ok(hres == S_OK, "get_display failed: %08x\n", hres);
+ ok(!str, "display = %s\n", wine_dbgstr_w(str));
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_visibility(style, &str);
+ ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
+ ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
+
+ V_VT(&v) = VT_NULL;
+ hres = IHTMLStyle_get_fontSize(style, &v);
+ ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+
+ V_VT(&v) = VT_NULL;
+ hres = IHTMLStyle_get_color(style, &v);
+ ok(hres == S_OK, "get_color failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+
+ b = 0xfefe;
+ hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
+ ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
+ ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
+
+ hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
+ ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
+ ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
+ ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
+
+ b = 0xfefe;
+ hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
+ ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
+ ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
+
+ hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
+ ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
+ ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
+ ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
+
+ b = 0xfefe;
+ hres = IHTMLStyle_get_textDecorationNone(style, &b);
+ ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
+ ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
+
+ hres = IHTMLStyle_get_textDecorationNone(style, &b);
+ ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
+ ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
+ ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
+
+ b = 0xfefe;
+ hres = IHTMLStyle_get_textDecorationOverline(style, &b);
+ ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
+ ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
+
+ hres = IHTMLStyle_get_textDecorationOverline(style, &b);
+ ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
+ ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
+ ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
+
+ b = 0xfefe;
+ hres = IHTMLStyle_get_textDecorationBlink(style, &b);
+ ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
+ ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
+ ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
+
+ hres = IHTMLStyle_get_textDecorationBlink(style, &b);
+ ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
+ ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
+
+ hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
+ ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_textDecoration(style, &sDefault);
+ ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
+
+ str = a2bstr("invalid");
+ hres = IHTMLStyle_put_textDecoration(style, str);
+ ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none");
+ hres = IHTMLStyle_put_textDecoration(style, str);
+ ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("underline");
+ hres = IHTMLStyle_put_textDecoration(style, str);
+ ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("overline");
+ hres = IHTMLStyle_put_textDecoration(style, str);
+ ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("line-through");
+ hres = IHTMLStyle_put_textDecoration(style, str);
+ ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("blink");
+ hres = IHTMLStyle_put_textDecoration(style, str);
+ ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_textDecoration(style, &str);
+ ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "blink"), "str != blink\n");
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_textDecoration(style, sDefault);
+ ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ hres = IHTMLStyle_get_posWidth(style, NULL);
+ ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_posWidth(style, &f);
+ ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
+ ok(f == 0.0f, "f = %f\n", f);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_width(style, &v);
+ ok(hres == S_OK, "get_width failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
+
+ hres = IHTMLStyle_put_posWidth(style, 2.2);
+ ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_posWidth(style, &f);
+ ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
+ ok(f == 2.0f ||
+ f == 2.2f, /* IE8 */
+ "f = %f\n", f);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("auto");
+ hres = IHTMLStyle_put_width(style, v);
+ ok(hres == S_OK, "put_width failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_width(style, &v);
+ ok(hres == S_OK, "get_width failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ /* margin tests */
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_margin(style, &str);
+ ok(hres == S_OK, "get_margin failed: %08x\n", hres);
+ ok(!str, "margin = %s\n", wine_dbgstr_w(str));
+
+ str = a2bstr("1");
+ hres = IHTMLStyle_put_margin(style, str);
+ ok(hres == S_OK, "put_margin failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_margin(style, &str);
+ ok(hres == S_OK, "get_margin failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
+
+ hres = IHTMLStyle_put_margin(style, NULL);
+ ok(hres == S_OK, "put_margin failed: %08x\n", hres);
+
+ str = NULL;
+ hres = IHTMLStyle_get_border(style, &str);
+ ok(hres == S_OK, "get_border failed: %08x\n", hres);
+ ok(!str || !*str, "str is not empty\n");
+ SysFreeString(str);
+
+ str = a2bstr("1px");
+ hres = IHTMLStyle_put_border(style, str);
+ ok(hres == S_OK, "put_border failed: %08x\n", hres);
+ SysFreeString(str);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_left(style, &v);
+ ok(hres == S_OK, "get_left failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+ VariantClear(&v);
+
+ /* Test posLeft */
+ hres = IHTMLStyle_get_posLeft(style, NULL);
+ ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
+
+ f = 1.0f;
+ hres = IHTMLStyle_get_posLeft(style, &f);
+ ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
+ ok(f == 0.0, "expected 0.0 got %f\n", f);
+
+ hres = IHTMLStyle_put_posLeft(style, 4.9f);
+ ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_posLeft(style, &f);
+ ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
+ ok(f == 4.0 ||
+ f == 4.9f, /* IE8 */
+ "expected 4.0 or 4.9 (IE8) got %f\n", f);
+
+ /* Ensure left is updated correctly. */
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_left(style, &v);
+ ok(hres == S_OK, "get_left failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "4px") ||
+ !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
+ "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ /* Test left */
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("3px");
+ hres = IHTMLStyle_put_left(style, v);
+ ok(hres == S_OK, "put_left failed: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_posLeft(style, &f);
+ ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
+ ok(f == 3.0, "expected 3.0 got %f\n", f);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_left(style, &v);
+ ok(hres == S_OK, "get_left failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ V_VT(&v) = VT_NULL;
+ hres = IHTMLStyle_put_left(style, v);
+ ok(hres == S_OK, "put_left failed: %08x\n", hres);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_left(style, &v);
+ ok(hres == S_OK, "get_left failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_top(style, &v);
+ ok(hres == S_OK, "get_top failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+ VariantClear(&v);
+
+ /* Test posTop */
+ hres = IHTMLStyle_get_posTop(style, NULL);
+ ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
+
+ f = 1.0f;
+ hres = IHTMLStyle_get_posTop(style, &f);
+ ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
+ ok(f == 0.0, "expected 0.0 got %f\n", f);
+
+ hres = IHTMLStyle_put_posTop(style, 4.9f);
+ ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_posTop(style, &f);
+ ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
+ ok(f == 4.0 ||
+ f == 4.9f, /* IE8 */
+ "expected 4.0 or 4.9 (IE8) got %f\n", f);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("3px");
+ hres = IHTMLStyle_put_top(style, v);
+ ok(hres == S_OK, "put_top failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_top(style, &v);
+ ok(hres == S_OK, "get_top failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_posTop(style, &f);
+ ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
+ ok(f == 3.0, "expected 3.0 got %f\n", f);
+
+ V_VT(&v) = VT_NULL;
+ hres = IHTMLStyle_put_top(style, v);
+ ok(hres == S_OK, "put_top failed: %08x\n", hres);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_top(style, &v);
+ ok(hres == S_OK, "get_top failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+ VariantClear(&v);
+
+ /* Test posHeight */
+ hres = IHTMLStyle_get_posHeight(style, NULL);
+ ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_height(style, &v);
+ ok(hres == S_OK, "get_height failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+ VariantClear(&v);
+
+ f = 1.0f;
+ hres = IHTMLStyle_get_posHeight(style, &f);
+ ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
+ ok(f == 0.0, "expected 0.0 got %f\n", f);
+
+ hres = IHTMLStyle_put_posHeight(style, 4.9f);
+ ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_posHeight(style, &f);
+ ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
+ ok(f == 4.0 ||
+ f == 4.9f, /* IE8 */
+ "expected 4.0 or 4.9 (IE8) got %f\n", f);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("64px");
+ hres = IHTMLStyle_put_height(style, v);
+ ok(hres == S_OK, "put_height failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_height(style, &v);
+ ok(hres == S_OK, "get_height failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_posHeight(style, &f);
+ ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
+ ok(f == 64.0, "expected 64.0 got %f\n", f);
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_cursor(style, &str);
+ ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
+ ok(!str, "get_cursor != NULL\n");
+ SysFreeString(str);
+
+ str = a2bstr("default");
+ hres = IHTMLStyle_put_cursor(style, str);
+ ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = NULL;
+ hres = IHTMLStyle_get_cursor(style, &str);
+ ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_verticalAlign(style, &v);
+ ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+ VariantClear(&v);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("middle");
+ hres = IHTMLStyle_put_verticalAlign(style, v);
+ ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_verticalAlign(style, &v);
+ ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_textAlign(style, &str);
+ ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
+ ok(!str, "textAlign != NULL\n");
+
+ str = a2bstr("center");
+ hres = IHTMLStyle_put_textAlign(style, str);
+ ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = NULL;
+ hres = IHTMLStyle_get_textAlign(style, &str);
+ ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ SysFreeString(str);
+
+ str = (void*)0xdeadbeef;
+ hres = IHTMLStyle_get_filter(style, &str);
+ ok(hres == S_OK, "get_filter failed: %08x\n", hres);
+ ok(!str, "filter != NULL\n");
+
+ str = a2bstr("alpha(opacity=100)");
+ hres = IHTMLStyle_put_filter(style, str);
+ ok(hres == S_OK, "put_filter failed: %08x\n", hres);
+ SysFreeString(str);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_zIndex(style, &v);
+ ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_I4(&v), "V_I4(v) != 0\n");
+ VariantClear(&v);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("1");
+ hres = IHTMLStyle_put_zIndex(style, v);
+ ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_zIndex(style, &v);
+ ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
+ ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
+ VariantClear(&v);
+
+ /* fontStyle */
+ hres = IHTMLStyle_get_fontStyle(style, &sDefault);
+ ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
+
+ str = a2bstr("test");
+ hres = IHTMLStyle_put_fontStyle(style, str);
+ ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("italic");
+ hres = IHTMLStyle_put_fontStyle(style, str);
+ ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("oblique");
+ hres = IHTMLStyle_put_fontStyle(style, str);
+ ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("normal");
+ hres = IHTMLStyle_put_fontStyle(style, str);
+ ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_fontStyle(style, sDefault);
+ ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* overflow */
+ hres = IHTMLStyle_get_overflow(style, NULL);
+ ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
+ ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
+
+ str = a2bstr("test");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("visible");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("scroll");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("hidden");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("auto");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_overflow(style, &str);
+ ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ str = a2bstr("");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_overflow(style, &str);
+ ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
+ ok(!str, "str=%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ /* restore overflow default */
+ hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(sOverflowDefault);
+
+ /* Attribute Tests*/
+ hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
+ ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
+
+ str = a2bstr("position");
+ hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
+ ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
+
+ hres = IHTMLStyle_getAttribute(style, str, 1, &v);
+ ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
+ ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("absolute");
+ hres = IHTMLStyle_setAttribute(style, str, v, 1);
+ ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_getAttribute(style, str, 1, &v);
+ ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = NULL;
+ hres = IHTMLStyle_setAttribute(style, str, v, 1);
+ ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
+ VariantClear(&v);
+
+ SysFreeString(str);
+
+ str = a2bstr("borderLeftStyle");
+ test_border_styles(style, str);
+ SysFreeString(str);
+
+ str = a2bstr("borderbottomstyle");
+ test_border_styles(style, str);
+ SysFreeString(str);
+
+ str = a2bstr("borderrightstyle");
+ test_border_styles(style, str);
+ SysFreeString(str);
+
+ str = a2bstr("bordertopstyle");
+ test_border_styles(style, str);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_borderStyle(style, &sDefault);
+ ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
+
+ str = a2bstr("none dotted dashed solid");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none dotted dashed solid");
+ hres = IHTMLStyle_get_borderStyle(style, &str);
+ ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "none dotted dashed solid"),
+ "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
+ SysFreeString(str);
+
+ str = a2bstr("double groove ridge inset");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("window-inset outset ridge inset");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("window-inset");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none none none none none");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("invalid none none none");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none invalid none none");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_borderStyle(style, sDefault);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* backgoundColor */
+ hres = IHTMLStyle_get_backgroundColor(style, &v);
+ ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ /* PaddingLeft */
+ hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
+ ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10");
+ hres = IHTMLStyle_put_paddingLeft(style, v);
+ ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_paddingLeft(style, &v);
+ ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
+ ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+
+ hres = IHTMLStyle_put_paddingLeft(style, vDefault);
+ ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
+
+ /* BackgroundRepeat */
+ hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
+ ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
+
+ str = a2bstr("invalid");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("repeat");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("no-repeat");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("repeat-x");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("repeat-y");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_backgroundRepeat(style, &str);
+ ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* BorderColor */
+ hres = IHTMLStyle_get_borderColor(style, &sDefault);
+ ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
+
+ str = a2bstr("red green red blue");
+ hres = IHTMLStyle_put_borderColor(style, str);
+ ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_borderColor(style, &str);
+ ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_borderColor(style, sDefault);
+ ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* BorderLeft */
+ hres = IHTMLStyle_get_borderLeft(style, &sDefault);
+ ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
+
+ str = a2bstr("thick dotted red");
+ hres = IHTMLStyle_put_borderLeft(style, str);
+ ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
+ SysFreeString(str);
+
+ /* IHTMLStyle_get_borderLeft appears to have a bug where
+ it returns the first letter of the color. So we check
+ each style individually.
+ */
+ V_BSTR(&v) = NULL;
+ hres = IHTMLStyle_get_borderLeftColor(style, &v);
+ todo_wine ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
+ todo_wine ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ V_BSTR(&v) = NULL;
+ hres = IHTMLStyle_get_borderLeftWidth(style, &v);
+ ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
+ ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_borderLeftStyle(style, &str);
+ ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_borderLeft(style, sDefault);
+ ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* backgroundPositionX */
+ hres = IHTMLStyle_get_backgroundPositionX(style, &vDefault);
+ ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10px");
+ hres = IHTMLStyle_put_backgroundPositionX(style, v);
+ ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_backgroundPositionX(style, &v);
+ ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_backgroundPositionX(style, vDefault);
+ ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* backgroundPositionY */
+ hres = IHTMLStyle_get_backgroundPositionY(style, &vDefault);
+ ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10px");
+ hres = IHTMLStyle_put_backgroundPositionY(style, v);
+ ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_backgroundPositionY(style, &v);
+ ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_backgroundPositionY(style, vDefault);
+ ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* borderTopWidth */
+ hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
+ ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10px");
+ hres = IHTMLStyle_put_borderTopWidth(style, v);
+ ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_borderTopWidth(style, &v);
+ ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
+ ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
+ ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* borderRightWidth */
+ hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
+ ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10");
+ hres = IHTMLStyle_put_borderRightWidth(style, v);
+ ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_borderRightWidth(style, &v);
+ ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
+ ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
+ ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* borderBottomWidth */
+ hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
+ ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10");
+ hres = IHTMLStyle_put_borderBottomWidth(style, v);
+ ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_borderBottomWidth(style, &v);
+ ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
+ ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
+ ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* borderLeftWidth */
+ hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
+ ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10");
+ hres = IHTMLStyle_put_borderLeftWidth(style, v);
+ ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_borderLeftWidth(style, &v);
+ ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
+ ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
+ ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* wordSpacing */
+ hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
+ ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("10");
+ hres = IHTMLStyle_put_wordSpacing(style, v);
+ ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_wordSpacing(style, &v);
+ ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_wordSpacing(style, vDefault);
+ ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ /* letterSpacing */
+ hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
+ ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
+
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = a2bstr("11");
+ hres = IHTMLStyle_put_letterSpacing(style, v);
+ ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
+ VariantClear(&v);
+
+ hres = IHTMLStyle_get_letterSpacing(style, &v);
+ ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
+ hres = IHTMLStyle_put_letterSpacing(style, vDefault);
+ ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
+ VariantClear(&vDefault);
+
+ hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
+ ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
+ if(SUCCEEDED(hres)) {
+ test_style2(style2);
+ IHTMLStyle2_Release(style2);
- }
++}
+
+ hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
+ ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
+ if(SUCCEEDED(hres)) {
+ test_style3(style3);
+ IHTMLStyle3_Release(style3);
+ }
+
+ hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
+ ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
+ if(SUCCEEDED(hres)) {
+ test_style4(style4);
+ IHTMLStyle4_Release(style4);
+ }
+ }
+
+ static void test_set_csstext(IHTMLStyle *style)
+ {
+ VARIANT v;
+ HRESULT hres;
+
+ test_style_set_csstext(style, "background-color: black;");
+
+ hres = IHTMLStyle_get_backgroundColor(style, &v);
+ ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+ }
+
+ static void test_default_selection(IHTMLDocument2 *doc)
+ {
+ IHTMLSelectionObject *selection;
+ IHTMLTxtRange *range;
+ IDispatch *disp;
+ BSTR str;
+ HRESULT hres;
+
+ hres = IHTMLDocument2_get_selection(doc, &selection);
+ ok(hres == S_OK, "get_selection failed: %08x\n", hres);
+
+ hres = IHTMLSelectionObject_get_type(selection, &str);
+ ok(hres == S_OK, "get_type failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "None"), "type = %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ hres = IHTMLSelectionObject_createRange(selection, &disp);
+ IHTMLSelectionObject_Release(selection);
+ ok(hres == S_OK, "createRange failed: %08x\n", hres);
+
+ hres = IDispatch_QueryInterface(disp, &IID_IHTMLTxtRange, (void**)&range);
+ IDispatch_Release(disp);
+ ok(hres == S_OK, "Could not get IHTMLTxtRange interface: %08x\n", hres);
+
+ test_range_text(range, NULL);
+ IHTMLTxtRange_Release(range);
+ }
+
+ static void test_doc_elem(IHTMLDocument2 *doc)
+ {
+ IHTMLDocument2 *doc_node, *owner_doc;
+ IHTMLElement *elem;
+ IHTMLDocument3 *doc3;
+ HRESULT hres;
+
+ hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
+ ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
+
+ hres = IHTMLDocument3_get_documentElement(doc3, &elem);
+ IHTMLDocument3_Release(doc3);
+ ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
- hres = IHTMLSelectionObject_get_type(selection, &str);
- ok(hres == S_OK, "get_type failed: %08x\n", hres);
- ok(!lstrcmpW(str, noneW), "type = %s\n", dbgstr_w(str));
- SysFreeString(str);
+ test_node_name((IUnknown*)elem, "HTML");
+ test_elem_tag((IUnknown*)elem, "HTML");
- hres = IHTMLSelectionObject_createRange(selection, &disp);
- IHTMLSelectionObject_Release(selection);
- ok(hres == S_OK, "createRange failed: %08x\n", hres);
+ doc_node = get_doc_node(doc);
+ owner_doc = get_owner_doc((IUnknown*)elem);
+ ok(iface_cmp((IUnknown *)doc_node, (IUnknown *)owner_doc), "doc_node != owner_doc\n");
+ IHTMLDocument2_Release(doc_node);
+ IHTMLDocument2_Release(owner_doc);
- hres = IDispatch_QueryInterface(disp, &IID_IHTMLTxtRange, (void**)&range);
- IDispatch_Release(disp);
- ok(hres == S_OK, "Could not get IHTMLTxtRange interface: %08x\n", hres);
+ test_elem_client_rect((IUnknown*)elem);
- test_range_text(range, NULL);
- IHTMLTxtRange_Release(range);
+ IHTMLElement_Release(elem);
}
static void test_default_body(IHTMLBodyElement *body)
node = test_node_get_parent((IUnknown*)node2);
IHTMLDOMNode_Release(node2);
ok(node != NULL, "node == NULL\n");
- test_node_name((IUnknown*)node, "#document");
- type = get_node_type((IUnknown*)node);
+ if (node)
+ {
- ok(type == 9, "type=%ld, expected 9\n", type);
+ test_node_name((IUnknown*)node, "#document");
+ type = get_node_type((IUnknown*)node);
- node2 = test_node_get_parent((IUnknown*)node);
- IHTMLDOMNode_Release(node);
- ok(node2 == NULL, "node != NULL\n");
+ ok(type == 9, "type=%d, expected 9\n", type);
+ node2 = test_node_get_parent((IUnknown*)node);
+ IHTMLDOMNode_Release(node);
+ ok(node2 == NULL, "node != NULL\n");
+ }
+
+ elem2 = test_elem_get_parent((IUnknown*)elem);
+ ok(elem2 != NULL, "elem2 == NULL\n");
+ test_node_name((IUnknown*)elem2, "BODY");
+ elem3 = test_elem_get_parent((IUnknown*)elem2);
+ IHTMLElement_Release(elem2);
+ ok(elem3 != NULL, "elem3 == NULL\n");
+ test_node_name((IUnknown*)elem3, "HTML");
+ elem2 = test_elem_get_parent((IUnknown*)elem3);
+ IHTMLElement_Release(elem3);
+ ok(elem2 == NULL, "elem2 != NULL\n");
+
+ test_elem_getelembytag((IUnknown*)elem, ET_OPTION, 2);
+ test_elem_getelembytag((IUnknown*)elem, ET_SELECT, 0);
+ test_elem_getelembytag((IUnknown*)elem, ET_HTML, 0);
+
+ test_elem_innertext(elem, "opt1opt2");
IHTMLElement_Release(elem);
}
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLScriptElement, (void**)&script);
ok(hres == S_OK, "Could not get IHTMLScriptElement interface: %08x\n", hres);
- hres = IHTMLScriptElement_get_type(script, &type);
- ok(hres == S_OK, "get_type failed: %08x\n", hres);
+ if(hres == S_OK)
+ {
+ VARIANT_BOOL vb;
+
- ok(!lstrcmpW(type, text_javascriptW), "Unexpected type %s\n", dbgstr_w(type));
+ hres = IHTMLScriptElement_get_type(script, &type);
+ ok(hres == S_OK, "get_type failed: %08x\n", hres);
- SysFreeString(type);
+ ok(!strcmp_wa(type, "text/javascript"), "Unexpected type %s\n", wine_dbgstr_w(type));
+ SysFreeString(type);
+ /* test defer */
+ hres = IHTMLScriptElement_put_defer(script, VARIANT_TRUE);
+ ok(hres == S_OK, "put_defer failed: %08x\n", hres);
+
+ hres = IHTMLScriptElement_get_defer(script, &vb);
+ ok(hres == S_OK, "get_defer failed: %08x\n", hres);
+ ok(vb == VARIANT_TRUE, "get_defer result is %08x\n", hres);
+
+ hres = IHTMLScriptElement_put_defer(script, VARIANT_FALSE);
+ ok(hres == S_OK, "put_defer failed: %08x\n", hres);
+ }
+
IHTMLScriptElement_Release(script);
}
test_stylesheets(doc);
test_create_option_elem(doc);
- }
+
+ elem = get_doc_elem_by_id(doc, "tbl");
+ ok(elem != NULL, "elem = NULL\n");
+ test_elem_set_innertext(elem, "inner text");
+ IHTMLElement_Release(elem);
+
+ test_doc_title(doc, "test");
+ test_doc_set_title(doc, "test title");
+ test_doc_title(doc, "test title");
+
+ disp = NULL;
+ hres = IHTMLDocument2_get_Script(doc, &disp);
+ ok(hres == S_OK, "get_Script failed: %08x\n", hres);
+ if(hres == S_OK)
+ {
+ IDispatchEx *dispex;
+ hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
+ ok(hres == S_OK, "IDispatch_QueryInterface failed: %08x\n", hres);
+ if(hres == S_OK)
+ {
+ DISPID pid = -1;
+ BSTR str = a2bstr("Testing");
+ hres = IDispatchEx_GetDispID(dispex, str, 1, &pid);
+ ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
+ ok(pid != -1, "pid == -1\n");
+ SysFreeString(str);
+ IDispatchEx_Release(dispex);
++}
+ }
+ IDispatch_Release(disp);
+
+ hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
+ ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
+
+ str = a2bstr("img");
+ hres = IHTMLDocument3_getElementsByTagName(doc3, str, &col);
+ ok(hres == S_OK, "getElementsByTagName(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
+ SysFreeString(str);
+ if(hres == S_OK)
+ {
+ static const elem_type_t img_types[] = { ET_IMG };
+
+ test_elem_collection((IUnknown*)col, img_types, sizeof(img_types)/sizeof(img_types[0]));
+ IHTMLElementCollection_Release(col);
+ }
+
+ elem = get_doc_elem_by_id(doc, "y");
+ test_elem_set_innerhtml((IUnknown*)elem, "inner html");
+ test_elem_innerhtml((IUnknown*)elem, "inner html");
+ test_elem_set_innerhtml((IUnknown*)elem, "");
+ test_elem_innerhtml((IUnknown*)elem, NULL);
+ IHTMLElement_Release(elem);
+
+ IHTMLDocument3_Release(doc3);
}
static void test_create_elems(IHTMLDocument2 *doc)
node = test_create_text(doc, "test");
test_ifaces((IUnknown*)node, text_iids);
- test_disp((IUnknown*)node, &DIID_DispHTMLDOMTextNode);
+ test_disp((IUnknown*)node, &DIID_DispHTMLDOMTextNode, "[object]");
+
+ V_VT(&var) = VT_NULL;
+ node2 = test_node_insertbefore((IUnknown*)body, node, &var);
+ IHTMLDOMNode_Release(node);
+
+ node = test_create_text(doc, "insert ");
+
+ V_VT(&var) = VT_DISPATCH;
+ V_DISPATCH(&var) = (IDispatch*)node2;
+ node3 = test_node_insertbefore((IUnknown*)body, node, &var);
IHTMLDOMNode_Release(node);
- }
+ IHTMLDOMNode_Release(node2);
+ IHTMLDOMNode_Release(node3);
+
+ test_elem_innertext(body, "insert test");
+ test_elem_innerhtml((IUnknown*)body, "insert test");
+
+ hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
+ if(hres == S_OK)
+ {
+ str = a2bstr("testing");
+ hres = IHTMLDocument5_createComment(doc5, str, &comment);
+ SysFreeString(str);
+ ok(hres == S_OK, "createComment failed: %08x\n", hres);
+ if(hres == S_OK)
+ {
+ type = get_node_type((IUnknown*)comment);
+ ok(type == 8, "type=%d, expected 8\n", type);
+
+ test_node_get_value_str((IUnknown*)comment, "testing");
+
+ IHTMLDOMNode_Release(comment);
++}
+
+ IHTMLDocument5_Release(doc5);
+ }
+
+ IHTMLElement_Release(body);
}
static void test_exec(IUnknown *unk, const GUID *grpid, DWORD cmdid, VARIANT *in, VARIANT *out)
CoInitialize(NULL);
run_domtest(doc_str1, test_doc_elem);
+ run_domtest(doc_str1, test_get_set_attr);
run_domtest(range_test_str, test_txtrange);
run_domtest(range_test2_str, test_txtrange2);
- run_domtest(elem_test_str, test_elems);
+ if (winetest_interactive || ! is_ie_hardened()) {
+ run_domtest(elem_test_str, test_elems);
+ }else {
+ skip("IE running in Enhanced Security Configuration\n");
+ }
run_domtest(doc_blank, test_create_elems);
run_domtest(doc_blank, test_defaults);
run_domtest(indent_test_str, test_indent);
switch(dispID) {
case DISPID_READYSTATE:
CHECK_EXPECT2(OnChanged_READYSTATE);
- test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
- | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
- ? OLECMDF_ENABLED : 0));
+
+ if(readystate_set_interactive) {
+ readystate_set_interactive = FALSE;
+ load_state = LD_INTERACTIVE;
+ }
+ else
+ test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
+ | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
+ ? OLECMDF_ENABLED : 0));
if(readystate_set_loading) {
readystate_set_loading = FALSE;
load_state = LD_LOADING;
}
- test_readyState(NULL);
+ if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
+ test_readyState(NULL);
return S_OK;
case 1005:
CHECK_EXPECT(OnChanged_1005);
- test_readyState(NULL);
+ if(!editmode)
- load_state = LD_INTERACTIVE;
+ test_readyState(NULL);
+ readystate_set_interactive = (load_state != LD_INTERACTIVE);
+ return S_OK;
+ case 1012:
+ CHECK_EXPECT(OnChanged_1012);
+ return S_OK;
+ case 3000029:
+ case 3000030:
+ /* TODO */
return S_OK;
}
IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
(IUnknown*)&ClientSite);
- SET_EXPECT(GetDisplayName);
+ if(mon == &Moniker)
+ SET_EXPECT(GetDisplayName);
if(!set_clientsite) {
SET_EXPECT(Invoke_AMBIENT_USERMODE);
SET_EXPECT(GetHostInfo);
}
SET_EXPECT(OnChanged_READYSTATE);
SET_EXPECT(Exec_ShellDocView_84);
- SET_EXPECT(BindToStorage);
+ SET_EXPECT(IsSystemMoniker);
+ if(mon == &Moniker)
+ SET_EXPECT(BindToStorage);
SET_EXPECT(SetActiveObject);
if(set_clientsite) {
SET_EXPECT(Invoke_AMBIENT_SILENT);
expect_LockContainer_fLock = TRUE;
readystate_set_loading = TRUE;
- hres = IPersistMoniker_Load(persist, FALSE, &Moniker, bind, 0x12);
+ hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
ok(hres == S_OK, "Load failed: %08x\n", hres);
- CHECK_CALLED(GetDisplayName);
+ if(mon == &Moniker)
+ CHECK_CALLED(GetDisplayName);
if(!set_clientsite) {
CHECK_CALLED(Invoke_AMBIENT_USERMODE);
CHECK_CALLED(GetHostInfo);
container_locked = TRUE;
}
CHECK_CALLED(OnChanged_READYSTATE);
+ SET_CALLED(IsSystemMoniker); /* IE7 */
SET_CALLED(Exec_ShellDocView_84);
- CHECK_CALLED(BindToStorage);
+ if(mon == &Moniker)
+ CHECK_CALLED(BindToStorage);
SET_CALLED(SetActiveObject); /* FIXME */
if(set_clientsite) {
CHECK_CALLED(Invoke_AMBIENT_SILENT);
test_readyState(NULL);
- if(verb_done) {
+ if(flags & (DWL_VERBDONE|DWL_HTTP))
SET_EXPECT(Exec_SETPROGRESSMAX);
- if(!load_from_stream)
+ if((flags & DWL_VERBDONE) && !load_from_stream)
- SET_EXPECT(GetHostInfo);
+ SET_EXPECT(GetHostInfo);
- }
SET_EXPECT(SetStatusText);
SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
SET_EXPECT(GetDropTarget);
DispatchMessage(&msg);
}
- if(verb_done) {
+ if(flags & DWL_VERBDONE)
CHECK_CALLED(Exec_SETPROGRESSMAX);
- if(!load_from_stream)
+ if(flags & DWL_HTTP)
+ SET_CALLED(Exec_SETPROGRESSMAX);
+ if((flags & DWL_VERBDONE) && !load_from_stream)
- CHECK_CALLED(GetHostInfo);
+ CHECK_CALLED(GetHostInfo);
- }
CHECK_CALLED(SetStatusText);
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
CHECK_CALLED(GetDropTarget);
static HRESULT create_document(IUnknown **unk)
{
- HRESULT hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
+ IHTMLDocument5 *doc5;
+ HRESULT hres;
+
+ hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IUnknown, (void**)unk);
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
- return hres;
+ if(FAILED(hres))
- }
++ return hres;
+
+ hres = IUnknown_QueryInterface(*unk, &IID_IHTMLDocument5, (void**)&doc5);
+ if(SUCCEEDED(hres)) {
+ IHTMLDocument5_Release(doc5);
+ }else {
+ win_skip("Could not get IHTMLDocument5, probably too old IE\n");
+ IUnknown_Release(*unk);
++}
+
return hres;
}
container_hwnd = create_container_window();
register_protocol();
- test_HTMLDocument(FALSE);
- test_HTMLDocument(TRUE);
- test_HTMLDocument_StreamLoad();
- test_editing_mode(FALSE);
- test_editing_mode(TRUE);
+ test_HTMLDocument_hlink();
+ if(!show_failed) {
- test_HTMLDocument_hlink();
+ test_HTMLDocument(FALSE);
+ test_HTMLDocument(TRUE);
+ test_HTMLDocument_StreamLoad();
+ test_editing_mode(FALSE);
+ test_editing_mode(TRUE);
+ test_HTMLDocument_http();
+ }
+ test_HTMLDoc_ISupportErrorInfo();
+ test_IPersistHistory();
DestroyWindow(container_hwnd);
CoUninitialize();
return;
}
+ SetLastError(0xdeadbeef);
len = SearchPathW(NULL, file, NULL, sizeof(buf)/sizeof(WCHAR), buf, NULL);
if(!len) {
- ok(0, "SearchPath failed: %u\n", GetLastError());
+ if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ win_skip("SearchPathW is not implemented\n");
+ else
+ ok(0, "SearchPath failed: %u\n", GetLastError());
return;
}
IDispatch **ppdisp)
{
CHECK_EXPECT(GetScriptDispatch);
- return E_NOTIMPL;
+
+ ok(!strcmp_wa(pstrItemName, "window"), "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName));
+
+ if(!script_disp)
+ return E_NOTIMPL;
+
+ *ppdisp = script_disp;
+ return S_OK;
}
static HRESULT WINAPI ActiveScript_GetCurrentScriptThreadID(IActiveScript *iface,
gecko_installer_workaround(TRUE);
CoInitialize(NULL);
- if(register_script_engine()) {
- test_simple_script();
- init_registry(FALSE);
- }else {
- skip("Could not register TestScript engine\n");
- }
+ if(winetest_interactive || ! is_ie_hardened()) {
+ if(register_script_engine()) {
+ test_simple_script();
+ init_registry(FALSE);
+ }else {
+ skip("Could not register TestScript engine\n");
+ }
+ }else {
+ skip("IE running in Enhanced Security Configuration\n");
+ }
CoUninitialize();
gecko_installer_workaround(FALSE);
const struct test winetest_testlist[] =
{
{ "dom", func_dom },
- { "htmldoc", func_htmldoc },
+ { "events", func_events },
+ { "htmldoc", func_htmldoc },
{ "misc", func_misc },
{ "protocol", func_protocol },
{ "script", func_script },
"PRIMARY KEY `Name` )" );
}
- static UINT add_component_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Component` "
- "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, 0, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
+ #define make_add_entry(type, qtext) \
+ static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
+ { \
+ char insert[] = qtext; \
+ char *query; \
+ UINT sz, r; \
+ sz = strlen(values) + sizeof insert; \
+ query = HeapAlloc(GetProcessHeap(),0,sz); \
+ sprintf(query,insert,values); \
+ r = run_query( hdb, 0, query ); \
+ HeapFree(GetProcessHeap(), 0, query); \
+ return r; \
- }
+}
- static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `FeatureComponents` "
- "(`Feature_`, `Component_`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, 0, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(component,
+ "INSERT INTO `Component` "
+ "(`Component`, `ComponentId`, `Directory_`, "
+ "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
- static UINT add_std_dlls_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `StdDlls` "
- "(`File`, `Binary_`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, 0, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(custom_action,
+ "INSERT INTO `CustomAction` "
+ "(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
- static UINT add_binary_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Binary` "
- "(`Name`, `Data`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, 0, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(feature_components,
+ "INSERT INTO `FeatureComponents` "
+ "(`Feature_`, `Component_`) VALUES( %s )")
+
+ make_add_entry(std_dlls,
+ "INSERT INTO `StdDlls` (`File`, `Binary_`) VALUES( %s )")
+
+ make_add_entry(binary,
+ "INSERT INTO `Binary` (`Name`, `Data`) VALUES( %s )")
static void test_msiinsert(void)
{
ok(r == ERROR_SUCCESS, "failed to set string\n");
r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
- todo_wine
- {
- ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
+ ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
- }
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n");
if( r == ERROR_SUCCESS )
{
MsiViewGetColumnInfo( hview, type, &rec );
- MsiViewClose(hview);
}
- MsiViewClose(hview);
++ MsiViewClose(hview);
MsiCloseHandle(hview);
return rec;
}
type = MsiRecordGetInteger( rec, 4 );
MsiCloseHandle( rec );
}
-
- MsiViewClose(hview);
}
- MsiViewClose(hview);
++ MsiViewClose(hview);
MsiCloseHandle(hview);
return type;
}
DWORD written;
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
- ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
- WriteFile(file, name, strlen(name), &written, NULL);
+ if (file == INVALID_HANDLE_VALUE)
+ return;
+
+ WriteFile(file, data, strlen(data), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL);
+
+ if (size)
+ {
+ SetFilePointer(file, size, NULL, FILE_BEGIN);
+ SetEndOfFile(file);
+ }
+
CloseHandle(file);
}
-
+
+ #define create_file(name) create_file_data(name, name, 0)
+
static void test_streamtable(void)
{
MSIHANDLE hdb = 0, rec, view;
query = "INSERT INTO `Table` ( `A` ) VALUES ( 'This is a ''string'' ok' )";
r = run_query(hdb, 0, query);
- todo_wine
- {
- ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
+ ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
- }
query = "INSERT INTO `Table` ( `A` ) VALUES ( 'This is a '''string''' ok' )";
r = run_query(hdb, 0, query);
size = MAX_PATH;
r = MsiRecordGetString(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- todo_wine
- {
- ok(!lstrcmp(buf, "This is a \"string\" ok"),
- "Expected \"This is a \"string\" ok\", got %s\n", buf);
+ ok(!lstrcmp(buf, "This is a \"string\" ok"),
+ "Expected \"This is a \"string\" ok\", got %s\n", buf);
- }
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
- todo_wine
- {
- ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
+ ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
- }
+ MsiViewClose(hview);
MsiCloseHandle(hview);
write_file("import.idt", import_dat, (sizeof(import_dat) - 1) * sizeof(char));
query = "CREATE TABLE `Table`\r ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
- todo_wine
- {
- ok(r == ERROR_BAD_QUERY_SYNTAX,
- "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
+ ok(r == ERROR_BAD_QUERY_SYNTAX,
+ "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
- }
query = "CREATE TABLE `Table` \r( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
query = "CREATE TABLE `Four` ( `A` CHAR(72\r) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
- todo_wine
- {
- ok(r == ERROR_BAD_QUERY_SYNTAX,
- "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
+ ok(r == ERROR_BAD_QUERY_SYNTAX,
+ "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
- }
query = "CREATE TABLE `Four` ( `A` CHAR(\r72) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- todo_wine
- {
- ok(!lstrcmpA(buf, "\rOne"), "Expected \"\\rOne\", got \"%s\"\n", buf);
+ ok(!lstrcmpA(buf, "\rOne"), "Expected \"\\rOne\", got \"%s\"\n", buf);
- }
MsiCloseHandle(hrec);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- todo_wine
- {
- ok(!lstrcmpA(buf, "Tw\ro"), "Expected \"Tw\\ro\", got \"%s\"\n", buf);
+ ok(!lstrcmpA(buf, "Tw\ro"), "Expected \"Tw\\ro\", got \"%s\"\n", buf);
- }
MsiCloseHandle(hrec);
/* check the column types */
hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_TYPES);
ok(hrec, "failed to get column info hrecord\n");
- todo_wine
- {
- ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n");
- ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n");
+ ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n");
+ ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n");
- }
MsiCloseHandle(hrec);
/* now try the names */
hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_NAMES);
ok(hrec, "failed to get column info hrecord\n");
- todo_wine
- {
- ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n");
- ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n");
+ ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n");
+ ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n");
- }
MsiCloseHandle(hrec);
- /* insert a file into the _Storages table */
- create_file("test.txt");
+ create_storage("storage.bin");
hrec = MsiCreateRecord(2);
- MsiRecordSetString(hrec, 1, "data");
+ MsiRecordSetString(hrec, 1, "stgname");
- r = MsiRecordSetStream(hrec, 2, "test.txt");
+ r = MsiRecordSetStream(hrec, 2, "storage.bin");
ok(r == ERROR_SUCCESS, "Failed to add stream data to the hrecord: %d\n", r);
- DeleteFile("test.txt");
+ DeleteFileA("storage.bin");
- r = MsiDatabaseOpenView(hdb,
- "INSERT INTO `_Storages` (`Name`, `Data`) VALUES (?, ?)", &hview);
- todo_wine
- {
+ query = "INSERT INTO `_Storages` (`Name`, `Data`) VALUES (?, ?)";
+ r = MsiDatabaseOpenView(hdb, query, &hview);
- ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
+ ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
- }
r = MsiViewExecute(hview, hrec);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
+ ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
- }
MsiCloseHandle(hrec);
+ MsiViewClose(hview);
MsiCloseHandle(hview);
- r = MsiDatabaseOpenView(hdb,
- "SELECT `Name`, `Data` FROM `_Storages`", &hview);
- todo_wine
- {
+ query = "SELECT `Name`, `Data` FROM `_Storages`";
+ r = MsiDatabaseOpenView(hdb, query, &hview);
- ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
+ ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
- }
r = MsiViewExecute(hview, 0);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
+ ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
- }
r = MsiViewFetch(hview, &hrec);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Failed to fetch hrecord: %d\n", r);
+ ok(r == ERROR_SUCCESS, "Failed to fetch hrecord: %d\n", r);
- }
size = MAX_PATH;
r = MsiRecordGetString(hrec, 1, file, &size);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Failed to get string: %d\n", r);
+ ok(r == ERROR_SUCCESS, "Failed to get string: %d\n", r);
- ok(!lstrcmp(file, "data"), "Expected 'data', got %s\n", file);
- }
+ ok(!lstrcmp(file, "stgname"), "Expected \"stgname\", got \"%s\"\n", file);
size = MAX_PATH;
lstrcpyA(buf, "apple");
"PRIMARY KEY `Action`)" );
}
- static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
- "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
+ #define make_add_entry(type, qtext) \
+ static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
+ { \
+ char insert[] = qtext; \
+ char *query; \
+ UINT sz, r; \
+ sz = strlen(values) + sizeof insert; \
+ query = HeapAlloc(GetProcessHeap(),0,sz); \
+ sprintf(query,insert,values); \
+ r = run_query( hdb, query ); \
+ HeapFree(GetProcessHeap(), 0, query); \
+ return r; \
- }
+}
- static UINT add_component_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Component` "
- "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(feature,
+ "INSERT INTO `Feature` "
+ "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
+ "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
- static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `FeatureComponents` "
- "(`Feature_`, `Component_`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(component,
+ "INSERT INTO `Component` "
+ "(`Component`, `ComponentId`, `Directory_`, "
+ "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
- static UINT add_file_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `File` "
- "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(feature_components,
+ "INSERT INTO `FeatureComponents` "
+ "(`Feature_`, `Component_`) VALUES( %s )")
- static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(file,
+ "INSERT INTO `File` "
+ "(`File`, `Component_`, `FileName`, `FileSize`, "
+ "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
- static UINT add_custom_action_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `CustomAction` (`Action`, `Type`, `Source`, "
- "`Target`) VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(directory,
+ "INSERT INTO `Directory` "
+ "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
+
+ make_add_entry(custom_action,
+ "INSERT INTO `CustomAction` "
+ "(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
static UINT set_summary_info(MSIHANDLE hdb)
{
/* component with INSTALLSTATE_SOURCE */
lstrcpy( expected, "1: " );
lstrcat( expected, curr_dir );
- lstrcat( expected, "\\" );
+ if (strlen(curr_dir) > 3)
+ lstrcat( expected, "\\ " );
+ lstrcat( expected, " " );
size = MAX_PATH;
MsiRecordSetString( hrec, 1, "[$parietal]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
return 0;
}
- static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
+ static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
- BOOL fContinuation, void *pv)
+ BOOL fContinuation, void *pv)
{
return 0;
}
return FALSE;
}
- static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
+ static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
- USHORT *pattribs, int *err, void *pv)
+ USHORT *pattribs, int *err, void *pv)
{
BY_HANDLE_FILE_INFORMATION finfo;
FILETIME filetime;
/* build summary info */
r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
- todo_wine
- {
- ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
+ ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
- }
r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
+ ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
- }
r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
"{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
- todo_wine
- {
- ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
+ ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
- }
r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
+ ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
- }
r = MsiSummaryInfoPersist(suminfo);
- todo_wine
- {
- ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
+ ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
- }
r = MsiCloseHandle(suminfo);
ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
ok(!pf_exists("msitest\\helium"), "File not deleted\n");
ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
- todo_wine
- {
- ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
- ok(delete_pf("msitest", FALSE), "File deleted\n");
+ ok(delete_pf("msitest", FALSE), "File deleted\n");
- }
create_pf("msitest", FALSE);
create_pf("msitest\\hydrogen", TRUE);
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
- todo_wine
- {
- ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
- ok(delete_pf("msitest", FALSE), "File deleted\n");
+ ok(delete_pf("msitest", FALSE), "File deleted\n");
- }
create_pf("msitest", FALSE);
create_pf("msitest\\furlong", TRUE);
ok(pf_exists("msitest\\becquerel"), "File not installed\n");
ok(pf_exists("msitest\\dioptre"), "File not installed\n");
ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
- ok(pf_exists("msitest"), "File not installed\n");
- todo_wine
- {
- ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
- ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
- ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
- ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
- ok(!pf_exists("msitest\\block"), "File not deleted\n");
- ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
+ ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
+ ok(!pf_exists("msitest\\block"), "File not deleted\n");
+ ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
- }
+ ok(pf_exists("msitest\\cabout"), "Directory removed\n");
+ ok(pf_exists("msitest"), "File not installed\n");
create_pf("msitest\\furlong", TRUE);
create_pf("msitest\\firkin", TRUE);
ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
- ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
- ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
- todo_wine
- {
- ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
- ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
- ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
+ ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
+ ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
+ ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
- ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
- ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
+ ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
+ ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
- }
- ok(delete_pf("msitest", FALSE), "File deleted\n");
+ ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
+ ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
+ ok(pf_exists("msitest"), "Directory deleted\n");
+
+ r = MsiInstallProductA(msifile, NULL);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
+ ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
+ ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
+ ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
+ ok(pf_exists("msitest"), "Directory deleted\n");
+
+ delete_pf("msitest\\cabout\\blocker", TRUE);
+
+ r = MsiInstallProductA(msifile, "REMOVE=ALL");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
+ ok(delete_pf("msitest", FALSE), "Directory deleted\n");
DeleteFile(msifile);
DeleteFile("msitest\\hydrogen");
create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
r = MsiInstallProductA(msifile, NULL);
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ ok(r == ERROR_SUCCESS ||
+ broken(r == ERROR_INSTALL_FAILURE), /* win9x */
+ "Expected ERROR_SUCCESS, got %u\n", r);
+ if (r == ERROR_SUCCESS)
+ {
- ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
+ ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
+ ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
+ }
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
- ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
RemoveDirectoryA("msitest");
r = MsiInstallProductA(msifile, NULL);
- todo_wine
- {
- ok(r == ERROR_INSTALL_FAILURE,
- "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
- ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
+ ok(r == ERROR_INSTALL_FAILURE,
+ "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+ ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
+ todo_wine
+ {
ok(!delete_pf("msitest", FALSE), "File installed\n");
}
static UINT (WINAPI *pMsiQueryComponentStateA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
static INSTALLSTATE (WINAPI *pMsiUseFeatureExA)
- (LPCSTR, LPCSTR ,DWORD, DWORD);
+ (LPCSTR, LPCSTR ,DWORD, DWORD );
+ static UINT (WINAPI *pMsiGetPatchInfoExA)
+ (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, DWORD *);
static void init_functionpointers(void)
{
"PRIMARY KEY `Signature_`)" );
}
- static UINT add_component_entry( MSIHANDLE hdb, const char *values )
+ static UINT create_inilocator_table( MSIHANDLE hdb )
{
- char insert[] = "INSERT INTO `Component` "
- "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
+ return run_query( hdb,
+ "CREATE TABLE `IniLocator` ("
+ "`Signature_` CHAR(72) NOT NULL, "
+ "`FileName` CHAR(255) NOT NULL, "
+ "`Section` CHAR(96)NOT NULL, "
+ "`Key` CHAR(128)NOT NULL, "
+ "`Field` SHORT, "
+ "`Type` SHORT "
+ "PRIMARY KEY `Signature_`)" );
}
- static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
- "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
+ #define make_add_entry(type, qtext) \
+ static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
+ { \
+ char insert[] = qtext; \
+ char *query; \
+ UINT sz, r; \
+ sz = strlen(values) + sizeof insert; \
+ query = HeapAlloc(GetProcessHeap(),0,sz); \
+ sprintf(query,insert,values); \
+ r = run_query( hdb, query ); \
+ HeapFree(GetProcessHeap(), 0, query); \
+ return r; \
- }
+}
- static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `FeatureComponents` "
- "(`Feature_`, `Component_`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(component,
+ "INSERT INTO `Component` "
+ "(`Component`, `ComponentId`, `Directory_`, "
+ "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
- static UINT add_file_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `File` "
- "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(directory,
+ "INSERT INTO `Directory` "
+ "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
- static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `AppSearch` "
- "(`Property`, `Signature_`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(feature,
+ "INSERT INTO `Feature` "
+ "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
+ "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
- static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `RegLocator` "
- "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(feature_components,
+ "INSERT INTO `FeatureComponents` "
+ "(`Feature_`, `Component_`) VALUES( %s )")
- static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Signature` "
+ make_add_entry(file,
+ "INSERT INTO `File` "
+ "(`File`, `Component_`, `FileName`, `FileSize`, "
+ "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
+
+ make_add_entry(appsearch,
+ "INSERT INTO `AppSearch` "
+ "(`Property`, `Signature_`) VALUES( %s )")
+
+ make_add_entry(reglocator,
+ "INSERT INTO `RegLocator` "
+ "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
+
+ make_add_entry(signature,
+ "INSERT INTO `Signature` "
- "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
- " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
+ "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
+ " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ "VALUES( %s )")
- static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `LaunchCondition` "
- "(`Condition`, `Description`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(launchcondition,
+ "INSERT INTO `LaunchCondition` "
+ "(`Condition`, `Description`) VALUES( %s )")
- static UINT add_property_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Property` "
- "(`Property`, `Value`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(property,
+ "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
- static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `InstallExecuteSequence` "
- "(`Action`, `Condition`, `Sequence`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(install_execute_sequence,
+ "INSERT INTO `InstallExecuteSequence` "
+ "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
- static UINT add_media_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `Media` "
- "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(media,
+ "INSERT INTO `Media` "
+ "(`DiskId`, `LastSequence`, `DiskPrompt`, "
+ "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
- static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(ccpsearch,
+ "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
- static UINT add_drlocator_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `DrLocator` "
- "(`Signature_`, `Parent`, `Path`, `Depth`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(drlocator,
+ "INSERT INTO `DrLocator` "
+ "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
- static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
- {
- char insert[] = "INSERT INTO `CompLocator` "
- "(`Signature_`, `ComponentId`, `Type`) "
- "VALUES( %s )";
- char *query;
- UINT sz, r;
-
- sz = strlen(values) + sizeof insert;
- query = HeapAlloc(GetProcessHeap(),0,sz);
- sprintf(query,insert,values);
- r = run_query( hdb, query );
- HeapFree(GetProcessHeap(), 0, query);
- return r;
- }
+ make_add_entry(complocator,
+ "INSERT INTO `CompLocator` "
+ "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
+
+ make_add_entry(inilocator,
+ "INSERT INTO `IniLocator` "
+ "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
+ "VALUES( %s )")
static UINT set_summary_info(MSIHANDLE hdb)
{
r = MsiGetFeatureState(hpkg, "six", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "seven", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "lambda", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "mu", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "nu", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "xi", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "omicron", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "pi", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "rho", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "sigma", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
MsiCloseHandle( hpkg );
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "one", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "two", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
- }
ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "four", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "six", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "seven", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "beta", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
- }
ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "gamma", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "theta", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "delta", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "zeta", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "iota", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "eta", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- todo_wine
- {
- ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee;
r = MsiGetComponentState(hpkg, "lambda", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "mu", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "nu", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "xi", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "omicron", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "pi", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "rho", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "sigma", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- todo_wine
- {
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
- }
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
MsiCloseHandle(hpkg);
r = MsiInstallProduct(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- DeleteFileA(msifile);
- }
-
- static void test_getproperty(void)
- {
- MSIHANDLE hPackage = 0;
- char prop[100];
- static CHAR empty[] = "";
- DWORD size;
- UINT r;
+ /* all features installed locally */
+ r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- hPackage = package_from_db(create_package_db());
- ok( hPackage != 0, " Failed to create package\n");
+ r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
+ ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
- /* set the property */
- r = MsiSetProperty(hPackage, "Name", "Value");
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ /* these properties must not be in the saved msi file */
+ r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
+ ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
- /* retrieve the size, NULL pointer */
- size = 0;
- r = MsiGetProperty(hPackage, "Name", NULL, &size);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok( size == 5, "Expected 5, got %d\n", size);
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
- /* retrieve the size, empty string */
- size = 0;
- r = MsiGetProperty(hPackage, "Name", empty, &size);
- ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
- ok( size == 5, "Expected 5, got %d\n", size);
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
- /* don't change size */
- r = MsiGetProperty(hPackage, "Name", prop, &size);
- ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
- ok( size == 5, "Expected 5, got %d\n", size);
- ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
- /* increase the size by 1 */
- size++;
- r = MsiGetProperty(hPackage, "Name", prop, &size);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok( size == 5, "Expected 5, got %d\n", size);
- ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
- r = MsiCloseHandle( hPackage);
- ok( r == ERROR_SUCCESS , "Failed to close package\n" );
- DeleteFile(msifile);
- }
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
- static void test_removefiles(void)
- {
- MSIHANDLE hpkg;
- UINT r;
- MSIHANDLE hdb;
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
- hdb = create_package_db();
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "CostInitialize");
+ ok( r == ERROR_SUCCESS, "cost init failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "FileCost");
+ ok( r == ERROR_SUCCESS, "file cost failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "CostFinalize");
+ ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ MsiCloseHandle(hpkg);
+
+ /* uninstall the product */
+ r = MsiInstallProduct(msifile2, "REMOVE=ALL");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* all features installed from source */
+ r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
+ ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
+
+ /* this property must not be in the saved msi file */
+ r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
+ ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
+
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "CostInitialize");
+ ok( r == ERROR_SUCCESS, "cost init failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "FileCost");
+ ok( r == ERROR_SUCCESS, "file cost failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "CostFinalize");
+ ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ MsiCloseHandle(hpkg);
+
+ /* reinstall the product */
+ r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
+ ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
+
+ /* this property must not be in the saved msi file */
+ r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
+ ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
+
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
+ ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
+ ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "CostInitialize");
+ ok( r == ERROR_SUCCESS, "cost init failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "FileCost");
+ ok( r == ERROR_SUCCESS, "file cost failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiDoAction( hpkg, "CostFinalize");
+ ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "one", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "two", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "three", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "four", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "five", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "six", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "seven", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "eight", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "nine", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "ten", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "alpha", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "beta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "gamma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "theta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "zeta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "iota", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "eta", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "kappa", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lambda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "mu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "nu", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "xi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "omicron", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "pi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "rho", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "sigma", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+ ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "tau", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "phi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "chi", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+ ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
+
+ MsiCloseHandle(hpkg);
+
+ /* uninstall the product */
+ r = MsiInstallProduct(msifile4, "REMOVE=ALL");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ DeleteFileA(msifile);
+ DeleteFileA(msifile2);
+ DeleteFileA(msifile3);
+ DeleteFileA(msifile4);
+ }
+
+ static void test_getproperty(void)
+ {
+ MSIHANDLE hPackage = 0;
+ char prop[100];
+ static CHAR empty[] = "";
+ DWORD size;
+ UINT r;
+
+ hPackage = package_from_db(create_package_db());
+ ok( hPackage != 0, " Failed to create package\n");
+
+ /* set the property */
+ r = MsiSetProperty(hPackage, "Name", "Value");
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* retrieve the size, NULL pointer */
+ size = 0;
+ r = MsiGetProperty(hPackage, "Name", NULL, &size);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok( size == 5, "Expected 5, got %d\n", size);
+
+ /* retrieve the size, empty string */
+ size = 0;
+ r = MsiGetProperty(hPackage, "Name", empty, &size);
+ ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
+ ok( size == 5, "Expected 5, got %d\n", size);
+
+ /* don't change size */
+ r = MsiGetProperty(hPackage, "Name", prop, &size);
+ ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
+ ok( size == 5, "Expected 5, got %d\n", size);
+ ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
+
+ /* increase the size by 1 */
+ size++;
+ r = MsiGetProperty(hPackage, "Name", prop, &size);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok( size == 5, "Expected 5, got %d\n", size);
+ ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
+
+ r = MsiCloseHandle( hPackage);
+ ok( r == ERROR_SUCCESS , "Failed to close package\n" );
+ DeleteFile(msifile);
+ }
+
+ static void test_removefiles(void)
+ {
+ MSIHANDLE hpkg;
+ UINT r;
+ MSIHANDLE hdb;
+
+ hdb = create_package_db();
+ ok ( hdb, "failed to create package database\n" );
+
+ r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
+ ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
+
+ r = create_feature_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
+
+ r = create_component_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
+
+ r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
+ ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+
+ r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ r = create_feature_components_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'one', 'helium'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'one', 'lithium'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'one', 'boron'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'one', 'carbon'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = create_file_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
+
+ r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = create_remove_file_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
+
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
+
+ MsiCloseHandle( hdb );
+
+ create_test_file( "hydrogen.txt" );
+ create_test_file( "helium.txt" );
+ create_test_file( "lithium.txt" );
+ create_test_file( "beryllium.txt" );
+ create_test_file( "boron.txt" );
+ create_test_file( "carbon.txt" );
+
+ r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
+ ok( r == ERROR_SUCCESS, "set property failed\n");
+
+ r = MsiDoAction( hpkg, "CostInitialize");
+ ok( r == ERROR_SUCCESS, "cost init failed\n");
+
+ r = MsiDoAction( hpkg, "FileCost");
+ ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+
+ r = MsiDoAction( hpkg, "CostFinalize");
+ ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+
+ r = MsiDoAction( hpkg, "InstallValidate");
+ ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+
+ r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
+ ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+
+ r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
+ ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+
+ r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
+ ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+
+ r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
+ ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+
+ r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
+ ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+
+ r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
+ ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+
+ r = MsiDoAction( hpkg, "RemoveFiles");
+ ok( r == ERROR_SUCCESS, "remove files failed\n");
+
+ ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
+ ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
+ ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
+ ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
+ ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
+ ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
+
+ MsiCloseHandle( hpkg );
+ DeleteFileA(msifile);
+ }
+
+ static void test_appsearch(void)
+ {
+ MSIHANDLE hpkg;
+ UINT r;
+ MSIHANDLE hdb;
+ CHAR prop[MAX_PATH];
+ DWORD size = MAX_PATH;
+
+ hdb = create_package_db();
+ ok ( hdb, "failed to create package database\n" );
+
+ r = create_appsearch_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
+
+ r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
+ ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
+
+ r = create_reglocator_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
+
+ r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
+ ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
+
+ r = create_signature_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
+
+ r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
+ ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
+
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
+
+ MsiCloseHandle( hdb );
+
+ r = MsiDoAction( hpkg, "AppSearch" );
+ ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
+
+ r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
+ ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
+ todo_wine
+ {
- ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
++ ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
+ }
+
+ MsiCloseHandle( hpkg );
+ DeleteFileA(msifile);
+ }
+
+ static void test_appsearch_complocator(void)
+ {
+ MSIHANDLE hpkg, hdb;
+ CHAR path[MAX_PATH];
+ CHAR prop[MAX_PATH];
+ LPSTR usersid;
+ DWORD size;
+ UINT r;
+
+ if (!get_user_sid(&usersid))
+ return;
+
+ create_test_file("FileName1");
+ create_test_file("FileName4");
+ set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
+ "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
+
+ create_test_file("FileName2");
+ set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
+ "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
+
+ create_test_file("FileName3");
+ set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
+ "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
+
+ create_test_file("FileName5");
+ set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
+ "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
+
+ create_test_file("FileName6");
+ set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
+ "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
+
+ create_test_file("FileName7");
+ set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
+ "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
+
+ /* dir is FALSE, but we're pretending it's a directory */
+ set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
+ "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
+
+ create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
+ "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
+
+ create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
+ set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
+ "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
+
+ create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
+ "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
+
+ hdb = create_package_db();
+ ok(hdb, "Expected a valid database handle\n");
+
+ r = create_appsearch_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_complocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, machine, file, signature, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, user-managed, file, signature, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, machine, file, signature, misdbLocatorTypeDirectory */
+ r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
+ r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
+ r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, machine, file, no signature, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* unpublished component, no signature, misdbLocatorTypeDir */
+ r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, no signature, dir does not exist misdbLocatorTypeDir */
+ r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, signature w/ ver, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
+ r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_signature_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "Expected a valid package handle\n");
+
+ r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = MsiDoAction(hpkg, "AppSearch");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName2", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName3", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName4", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName5", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName8.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName10.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
+ MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
+ delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
+ MSIINSTALLCONTEXT_USERMANAGED, usersid);
+ delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+
+ DeleteFileA("FileName1");
+ DeleteFileA("FileName2");
+ DeleteFileA("FileName3");
+ DeleteFileA("FileName4");
+ DeleteFileA("FileName5");
+ DeleteFileA("FileName6");
+ DeleteFileA("FileName7");
+ DeleteFileA("FileName8.dll");
+ DeleteFileA("FileName9.dll");
+ DeleteFileA("FileName10.dll");
+ MsiCloseHandle(hpkg);
+ DeleteFileA(msifile);
+ LocalFree(usersid);
+ }
+
+ static void test_appsearch_reglocator(void)
+ {
+ MSIHANDLE hpkg, hdb;
+ CHAR path[MAX_PATH];
+ CHAR prop[MAX_PATH];
+ DWORD binary[2];
+ DWORD size, val;
+ BOOL space, version;
+ HKEY hklm, classes;
+ HKEY hkcu, users;
+ LPSTR pathdata;
+ LPSTR pathvar;
+ LPCSTR str;
+ LPSTR ptr;
+ LONG res;
+ UINT r;
+
+ version = TRUE;
+ if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
+ version = FALSE;
+
+ DeleteFileA("test.dll");
+
+ res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
+ (const BYTE *)"regszdata", 10);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
+ (const BYTE *)"regszdata", 10);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ users = 0;
+ res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
+ ok(res == ERROR_SUCCESS ||
+ broken(res == ERROR_INVALID_PARAMETER),
+ "Expected ERROR_SUCCESS, got %d\n", res);
+
+ if (res == ERROR_SUCCESS)
+ {
+ res = RegSetValueExA(users, "Value1", 0, REG_SZ,
+ (const BYTE *)"regszdata", 10);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+ }
+
+ res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
+ (const BYTE *)"regszdata", 10);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ val = 42;
+ res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
+ (const BYTE *)&val, sizeof(DWORD));
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ val = -42;
+ res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
+ (const BYTE *)&val, sizeof(DWORD));
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
+ (const BYTE *)"%PATH%", 7);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
+ (const BYTE *)"my%NOVAR%", 10);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
+ (const BYTE *)"one\0two\0", 9);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ binary[0] = 0x1234abcd;
+ binary[1] = 0x567890ef;
+ res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
+ (const BYTE *)binary, sizeof(binary));
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
+ (const BYTE *)"#regszdata", 11);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ create_test_file("FileName1");
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ sprintf(path, "%s\\FileName2", CURR_DIR);
+ res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ lstrcpyA(path, CURR_DIR);
+ res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
+ (const BYTE *)"", 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+ res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
+ sprintf(path, "%s\\FileName4.dll", CURR_DIR);
+ res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ sprintf(path, "%s\\FileName5.dll", CURR_DIR);
+ res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
+ sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
+ res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+
+ space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
+ sprintf(path, "%s\\FileName1 -option", CURR_DIR);
+ res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+
+ hdb = create_package_db();
+ ok(hdb, "Expected a valid database handle\n");
+
+ r = create_appsearch_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_reglocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
+ str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
+ str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
+ str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
+ str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
+ str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
+ str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
+ str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
+ str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, signature, file exists */
+ str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
+ str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, no signature */
+ str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
+ str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
+ str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
+ str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
+ str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
+ str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKU, msidbLocatorTypeRawValue, REG_SZ */
+ str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
+ str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
+ str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
+ str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
+ str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
+ str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
+ str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
+ str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
+ str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
+ str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
+ str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
+ str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
+ str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
+ str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_signature_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ ptr = strrchr(CURR_DIR, '\\') + 1;
+ sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
+ r = add_signature_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "Expected a valid package handle\n");
+
+ r = MsiDoAction(hpkg, "AppSearch");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "regszdata"),
+ "Expected \"regszdata\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
+
+ size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
+ if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
+ {
+ /* Workaround for Win95 */
+ CHAR tempbuf[1];
+ size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
+ }
+ pathvar = HeapAlloc(GetProcessHeap(), 0, size);
+ ExpandEnvironmentStringsA("%PATH%", pathvar, size);
+
+ size = 0;
+ r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
+ r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(pathdata, pathvar),
+ "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
+
+ HeapFree(GetProcessHeap(), 0, pathvar);
+ HeapFree(GetProcessHeap(), 0, pathdata);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop,
+ "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ todo_wine
+ {
+ ok(!memcmp(prop, "\0one\0two\0\0", 10),
+ "Expected \"\\0one\\0two\\0\\0\"\n");
+ }
+
+ size = MAX_PATH;
+ lstrcpyA(path, "#xCDAB3412EF907856");
+ r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "##regszdata"),
+ "Expected \"##regszdata\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "regszdata"),
+ "Expected \"regszdata\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "regszdata"),
+ "Expected \"regszdata\", got \"%s\"\n", prop);
+
+ if (users)
+ {
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "regszdata"),
+ "Expected \"regszdata\", got \"%s\"\n", prop);
+ }
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "defvalue"),
+ "Expected \"defvalue\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ if (version)
+ {
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName5.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+ }
+
+ size = MAX_PATH;
+ lstrcpyA(path, CURR_DIR);
+ ptr = strrchr(path, '\\') + 1;
+ *ptr = '\0';
+ r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ if (space)
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+ else
+ todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ RegSetValueA(hklm, NULL, REG_SZ, "", 0);
+ RegDeleteValueA(hklm, "Value1");
+ RegDeleteValueA(hklm, "Value2");
+ RegDeleteValueA(hklm, "Value3");
+ RegDeleteValueA(hklm, "Value4");
+ RegDeleteValueA(hklm, "Value5");
+ RegDeleteValueA(hklm, "Value6");
+ RegDeleteValueA(hklm, "Value7");
+ RegDeleteValueA(hklm, "Value8");
+ RegDeleteValueA(hklm, "Value9");
+ RegDeleteValueA(hklm, "Value10");
+ RegDeleteValueA(hklm, "Value11");
+ RegDeleteValueA(hklm, "Value12");
+ RegDeleteValueA(hklm, "Value13");
+ RegDeleteValueA(hklm, "Value14");
+ RegDeleteValueA(hklm, "Value15");
+ RegDeleteValueA(hklm, "Value16");
+ RegDeleteValueA(hklm, "Value17");
+ RegDeleteKeyA(hklm, "");
+ RegCloseKey(hklm);
+
+ RegDeleteValueA(classes, "Value1");
+ RegDeleteKeyA(classes, "");
+ RegCloseKey(classes);
+
+ RegDeleteValueA(hkcu, "Value1");
+ RegDeleteKeyA(hkcu, "");
+ RegCloseKey(hkcu);
+
+ RegDeleteValueA(users, "Value1");
+ RegDeleteKeyA(users, "");
+ RegCloseKey(users);
+
+ DeleteFileA("FileName1");
+ DeleteFileA("FileName3.dll");
+ DeleteFileA("FileName4.dll");
+ DeleteFileA("FileName5.dll");
+ MsiCloseHandle(hpkg);
+ DeleteFileA(msifile);
+ }
+
+ static void delete_win_ini(LPCSTR file)
+ {
+ CHAR path[MAX_PATH];
+
+ GetWindowsDirectoryA(path, MAX_PATH);
+ lstrcatA(path, "\\");
+ lstrcatA(path, file);
+
+ DeleteFileA(path);
+ }
+
+ static void test_appsearch_inilocator(void)
+ {
+ MSIHANDLE hpkg, hdb;
+ CHAR path[MAX_PATH];
+ CHAR prop[MAX_PATH];
+ BOOL version;
+ LPCSTR str;
+ LPSTR ptr;
+ DWORD size;
+ UINT r;
+
+ version = TRUE;
+ if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
+ version = FALSE;
+
+ DeleteFileA("test.dll");
+
+ WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
+
+ create_test_file("FileName1");
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
+
+ WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
+
+ sprintf(path, "%s\\IDontExist", CURR_DIR);
+ WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
+
+ create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ sprintf(path, "%s\\FileName2.dll", CURR_DIR);
+ WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
+
+ create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
+ sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+ WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
+
+ create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ sprintf(path, "%s\\FileName4.dll", CURR_DIR);
+ WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
+
+ hdb = create_package_db();
+ ok(hdb, "Expected a valid database handle\n");
+
+ r = create_appsearch_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_inilocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeRawValue, field 1 */
+ str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeRawValue, field 2 */
+ str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeRawValue, entire field */
+ str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile */
+ str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeDirectory, file */
+ str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeDirectory, directory */
+ str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile, file, no signature */
+ str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile, dir, no signature */
+ str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile, file does not exist */
+ str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile, signature with version */
+ str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile, signature with version, ver > max */
+ str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* msidbLocatorTypeFile, signature with version, sig->name ignored */
+ str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
+ r = add_inilocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_signature_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "Expected a valid package handle\n");
+
+ r = MsiDoAction(hpkg, "AppSearch");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "keydata,field2"),
+ "Expected \"keydata,field2\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ lstrcpyA(path, CURR_DIR);
+ ptr = strrchr(path, '\\');
+ *(ptr + 1) = '\0';
+ r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ if (version)
+ {
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName2.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName4.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+ }
+
+ delete_win_ini("IniFile.ini");
+ DeleteFileA("FileName1");
+ DeleteFileA("FileName2.dll");
+ DeleteFileA("FileName3.dll");
+ DeleteFileA("FileName4.dll");
+ MsiCloseHandle(hpkg);
+ DeleteFileA(msifile);
+ }
+
+ /*
+ * MSI AppSearch action on DrLocator table always returns absolute paths.
+ * If a relative path was set, it returns the first absolute path that
+ * matches or an empty string if it didn't find anything.
+ * This helper function replicates this behaviour.
+ */
+ static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
+ {
+ int i, size;
+ DWORD attr, drives;
+
+ size = lstrlenA(relative);
+ drives = GetLogicalDrives();
+ lstrcpyA(absolute, "A:\\");
+ for (i = 0; i < 26; absolute[0] = '\0', i++)
+ {
+ if (!(drives & (1 << i)))
+ continue;
+
+ absolute[0] = 'A' + i;
+ if (GetDriveType(absolute) != DRIVE_FIXED)
+ continue;
+
+ lstrcpynA(absolute + 3, relative, size + 1);
+ attr = GetFileAttributesA(absolute);
+ if (attr != INVALID_FILE_ATTRIBUTES &&
+ (attr & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ if (absolute[3 + size - 1] != '\\')
+ lstrcatA(absolute, "\\");
+ break;
+ }
+ absolute[3] = '\0';
+ }
+ }
+
+ static void test_appsearch_drlocator(void)
+ {
+ MSIHANDLE hpkg, hdb;
+ CHAR path[MAX_PATH];
+ CHAR prop[MAX_PATH];
+ BOOL version;
+ LPCSTR str;
+ DWORD size;
+ UINT r;
+
+ version = TRUE;
+ if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
+ version = FALSE;
+
+ DeleteFileA("test.dll");
+
+ create_test_file("FileName1");
+ CreateDirectoryA("one", NULL);
+ CreateDirectoryA("one\\two", NULL);
+ CreateDirectoryA("one\\two\\three", NULL);
+ create_test_file("one\\two\\three\\FileName2");
+ CreateDirectoryA("another", NULL);
+ create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+ create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
+ create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
+
+ hdb = create_package_db();
+ ok(hdb, "Expected a valid database handle\n");
+
+ r = create_appsearch_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_drlocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 0, signature */
+ sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 0, no signature */
+ sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, relative path, depth 0, no signature */
+ sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 2, signature */
+ sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 3, signature */
+ sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 1, signature is dir */
+ sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* parent is in DrLocator, relative path, depth 0, signature */
+ sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 0, signature w/ version */
+ sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 0, signature w/ version, ver > max */
+ sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
+ sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* no parent, relative empty path, depth 0, no signature */
+ sprintf(path, "'NewSignature11', '', '', 0");
+ r = add_drlocator_entry(hdb, path);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_signature_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "Expected a valid package handle\n");
+
+ r = MsiDoAction(hpkg, "AppSearch");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ search_absolute_directory(path, CURR_DIR + 3);
+ r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ if (version)
+ {
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+ }
+
+ size = MAX_PATH;
+ search_absolute_directory(path, "");
+ r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ DeleteFileA("FileName1");
+ DeleteFileA("FileName3.dll");
+ DeleteFileA("FileName4.dll");
+ DeleteFileA("FileName5.dll");
+ DeleteFileA("one\\two\\three\\FileName2");
+ RemoveDirectoryA("one\\two\\three");
+ RemoveDirectoryA("one\\two");
+ RemoveDirectoryA("one");
+ RemoveDirectoryA("another");
+ MsiCloseHandle(hpkg);
+ DeleteFileA(msifile);
+ }
+
+ static void test_featureparents(void)
+ {
+ MSIHANDLE hpkg;
+ UINT r;
+ MSIHANDLE hdb;
+ INSTALLSTATE state, action;
+
+ hdb = create_package_db();
ok ( hdb, "failed to create package database\n" );
- r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
- ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
+ r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
+ ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
+
+ r = create_feature_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
+
+ r = create_component_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
+
+ r = create_feature_components_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
+
+ r = create_file_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal */
+ r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
+ ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+
+ /* msidbFeatureAttributesFavorSource */
+ r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
+ ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal */
+ r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
+ ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+
+ /* disabled because of install level */
+ r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
+ ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+
+ /* child feature of disabled feature */
+ r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
+ ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+
+ /* component of disabled feature (install level) */
+ r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* component of disabled child feature (install level) */
+ r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
+ r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
+ r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
+ r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
+ r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
+ r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
+ r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
+ r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
+ r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
+ ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+
+ /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
+ r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
+
+ r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'leo'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'libra'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'canis'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
+ ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+
+ r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
+ ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
+
+ MsiCloseHandle( hdb );
+
+ r = MsiDoAction( hpkg, "CostInitialize");
+ ok( r == ERROR_SUCCESS, "cost init failed\n");
+
+ r = MsiDoAction( hpkg, "FileCost");
+ ok( r == ERROR_SUCCESS, "file cost failed\n");
+
+ r = MsiDoAction( hpkg, "CostFinalize");
+ ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "orion", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "waters", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "leo", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "virgo", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "libra", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "canis", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lepus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
+ ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetFeatureState(hpkg, "orion", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
+ ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "leo", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "virgo", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "libra", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "canis", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "lepus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ state = 0xdeadbee;
+ action = 0xdeadbee;
+ r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
+ ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
+ ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
+
+ MsiCloseHandle(hpkg);
+ DeleteFileA(msifile);
+ }
+
+ static void test_installprops(void)
+ {
+ MSIHANDLE hpkg, hdb;
+ CHAR path[MAX_PATH];
+ CHAR buf[MAX_PATH];
+ DWORD size, type;
+ LANGID langid;
+ HKEY hkey1, hkey2;
+ int res;
+ UINT r;
+
+ GetCurrentDirectory(MAX_PATH, path);
+ lstrcat(path, "\\");
+ lstrcat(path, msifile);
+
+ hdb = create_package_db();
+ ok( hdb, "failed to create database\n");
+
+ hpkg = package_from_db(hdb);
+ ok( hpkg, "failed to create package\n");
+
+ MsiCloseHandle(hdb);
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
+
+ RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
+
+ RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
+
+ size = MAX_PATH;
+ type = REG_SZ;
+ *path = '\0';
+ if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
+ {
+ size = MAX_PATH;
+ type = REG_SZ;
+ RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
+ }
+
+ /* win9x doesn't set this */
+ if (*path)
+ {
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
+ }
+
+ size = MAX_PATH;
+ type = REG_SZ;
+ *path = '\0';
+ if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
+ {
+ size = MAX_PATH;
+ type = REG_SZ;
+ RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
+ }
+
+ if (*path)
+ {
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
+ }
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ trace("VersionDatabase = %s\n", buf);
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ trace("VersionMsi = %s\n", buf);
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "Date", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ trace("Date = %s\n", buf);
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "Time", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ trace("Time = %s\n", buf);
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
+ ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
+ trace("PackageCode = %s\n", buf);
+
+ langid = GetUserDefaultLangID();
+ sprintf(path, "%d", langid);
+
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
+ ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
+
+ res = GetSystemMetrics(SM_CXSCREEN);
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
+ ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
+
+ res = GetSystemMetrics(SM_CYSCREEN);
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
+ ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
+
+ CloseHandle(hkey1);
+ CloseHandle(hkey2);
+ MsiCloseHandle(hpkg);
+ DeleteFile(msifile);
+ }
+
+ static void test_launchconditions(void)
+ {
+ MSIHANDLE hpkg;
+ MSIHANDLE hdb;
+ UINT r;
+
+ MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
+
+ hdb = create_package_db();
+ ok( hdb, "failed to create package database\n" );
+
+ r = create_launchcondition_table( hdb );
+ ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
+
+ r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
+ ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
+
+ /* invalid condition */
+ r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
+ ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
+
+ hpkg = package_from_db( hdb );
+ ok( hpkg, "failed to create package\n");
+
+ MsiCloseHandle( hdb );
+
+ r = MsiSetProperty( hpkg, "X", "1" );
+ ok( r == ERROR_SUCCESS, "failed to set property\n" );
+
+ /* invalid conditions are ignored */
+ r = MsiDoAction( hpkg, "LaunchConditions" );
+ ok( r == ERROR_SUCCESS, "cost init failed\n" );
+
+ /* verify LaunchConditions still does some verification */
+ r = MsiSetProperty( hpkg, "X", "2" );
+ ok( r == ERROR_SUCCESS, "failed to set property\n" );
+
+ r = MsiDoAction( hpkg, "LaunchConditions" );
+ ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
+
+ MsiCloseHandle( hpkg );
+ DeleteFile( msifile );
+ }
+
+ static void test_ccpsearch(void)
+ {
+ MSIHANDLE hdb, hpkg;
+ CHAR prop[MAX_PATH];
+ DWORD size = MAX_PATH;
+ UINT r;
+
+ MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
+
+ hdb = create_package_db();
+ ok(hdb, "failed to create package database\n");
+
+ r = create_ccpsearch_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_ccpsearch_entry(hdb, "'CCP_random'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_reglocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_drlocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_signature_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "failed to create package\n");
+
+ MsiCloseHandle(hdb);
+
+ r = MsiDoAction(hpkg, "CCPSearch");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
+
+ MsiCloseHandle(hpkg);
+ DeleteFileA(msifile);
+ }
+
+ static void test_complocator(void)
+ {
+ MSIHANDLE hdb, hpkg;
+ UINT r;
+ CHAR prop[MAX_PATH];
+ CHAR expected[MAX_PATH];
+ DWORD size = MAX_PATH;
+
+ hdb = create_package_db();
+ ok(hdb, "failed to create package database\n");
+
+ r = create_appsearch_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = create_complocator_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = create_feature_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
+ r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = create_component_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
+ r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
- ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = create_feature_components_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
+ r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'one', 'helium'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'one', 'lithium'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = create_signature_table(hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'one', 'boron'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'one', 'carbon'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = create_file_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
+ r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "failed to create package\n");
- r = create_remove_file_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
+ MsiCloseHandle(hdb);
- hpkg = package_from_db( hdb );
- ok( hpkg, "failed to create package\n");
+ create_test_file("abelisaurus");
+ create_test_file("bactrosaurus");
+ create_test_file("camelotia");
+ create_test_file("diclonius");
+ create_test_file("echinodon");
+ create_test_file("falcarius");
+ create_test_file("gallimimus");
+ create_test_file("hagryphus");
+ CreateDirectoryA("iguanodon", NULL);
+ CreateDirectoryA("jobaria", NULL);
+ CreateDirectoryA("kakuru", NULL);
+ CreateDirectoryA("labocania", NULL);
+ CreateDirectoryA("megaraptor", NULL);
+ CreateDirectoryA("neosodon", NULL);
+ CreateDirectoryA("olorotitan", NULL);
+ CreateDirectoryA("pantydraco", NULL);
- MsiCloseHandle( hdb );
+ set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
+ "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
+ set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
+ "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
+ set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
+ "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
+ set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
+ "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
+ set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
+ "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
+ set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
+ "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
+ set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
+ "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
+ set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
+ "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
+
+ r = MsiDoAction(hpkg, "AppSearch");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ lstrcpyA(expected, CURR_DIR);
+ lstrcatA(expected, "\\abelisaurus");
+ ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
+ "Expected %s or empty string, got %s\n", expected, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ lstrcpyA(expected, CURR_DIR);
+ lstrcatA(expected, "\\");
+ ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
+ "Expected %s or empty string, got %s\n", expected, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ lstrcpyA(expected, CURR_DIR);
+ lstrcatA(expected, "\\");
+ ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
+ "Expected %s or empty string, got %s\n", expected, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ lstrcpyA(expected, CURR_DIR);
+ lstrcatA(expected, "\\neosodon\\");
+ ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
+ "Expected %s or empty string, got %s\n", expected, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
+
+ MsiCloseHandle(hpkg);
+ DeleteFileA("abelisaurus");
+ DeleteFileA("bactrosaurus");
+ DeleteFileA("camelotia");
+ DeleteFileA("diclonius");
+ DeleteFileA("echinodon");
+ DeleteFileA("falcarius");
+ DeleteFileA("gallimimus");
+ DeleteFileA("hagryphus");
+ RemoveDirectoryA("iguanodon");
+ RemoveDirectoryA("jobaria");
+ RemoveDirectoryA("kakuru");
+ RemoveDirectoryA("labocania");
+ RemoveDirectoryA("megaraptor");
+ RemoveDirectoryA("neosodon");
+ RemoveDirectoryA("olorotitan");
+ RemoveDirectoryA("pantydraco");
+ delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
+ MSIINSTALLCONTEXT_MACHINE, NULL);
+ DeleteFileA(msifile);
+ }
+
+ static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
+ {
+ MSIHANDLE summary;
+ UINT r;
+
+ r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = MsiSummaryInfoPersist(summary);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+ MsiCloseHandle(summary);
+ }
+
+ static void test_MsiGetSourcePath(void)
+ {
+ MSIHANDLE hdb, hpkg;
+ CHAR path[MAX_PATH];
+ CHAR cwd[MAX_PATH];
+ CHAR subsrc[MAX_PATH];
+ CHAR sub2[MAX_PATH];
+ DWORD size;
+ UINT r;
- create_test_file( "hydrogen.txt" );
- create_test_file( "helium.txt" );
- create_test_file( "lithium.txt" );
- create_test_file( "beryllium.txt" );
- create_test_file( "boron.txt" );
- create_test_file( "carbon.txt" );
+ lstrcpyA(cwd, CURR_DIR);
+ lstrcatA(cwd, "\\");
- r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
- ok( r == ERROR_SUCCESS, "set property failed\n");
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "subsource");
+ lstrcatA(subsrc, "\\");
- r = MsiDoAction( hpkg, "CostInitialize");
- ok( r == ERROR_SUCCESS, "cost init failed\n");
+ lstrcpyA(sub2, subsrc);
+ lstrcatA(sub2, "sub2");
+ lstrcatA(sub2, "\\");
- r = MsiDoAction( hpkg, "FileCost");
- ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+ /* uncompressed source */
- r = MsiDoAction( hpkg, "CostFinalize");
- ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+ hdb = create_package_db();
+ ok( hdb, "failed to create database\n");
- r = MsiDoAction( hpkg, "InstallValidate");
- ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+ set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
- r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
- ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+ r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
+ ok(r == S_OK, "failed\n");
- r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
- ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+ r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
+ ok(r == S_OK, "failed\n");
- r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
- ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+ r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
+ ok(r == S_OK, "failed\n");
- r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
- ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+ r = MsiDatabaseCommit(hdb);
+ ok(r == ERROR_SUCCESS , "Failed to commit database\n");
- r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
- ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "failed to create package\n");
- r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
- ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
+ MsiCloseHandle(hdb);
- r = MsiDoAction( hpkg, "RemoveFiles");
- ok( r == ERROR_SUCCESS, "remove files failed\n");
+ /* invalid database handle */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
+ ok(r == ERROR_INVALID_HANDLE,
+ "Expected ERROR_INVALID_HANDLE, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* NULL szFolder */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, NULL, path, &size);
+ ok(r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* empty szFolder */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try TARGETDIR */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try SourceDir */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try SOURCEDIR */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* source path does not exist, but the property exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
+ ok(size == 0, "Expected 0, got %d\n", size);
- ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
- ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
- ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
- ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
- ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
- ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
+ /* try SubDir */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try SubDir2 */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
- MsiCloseHandle( hpkg );
- DeleteFileA(msifile);
- }
+ r = MsiDoAction(hpkg, "CostInitialize");
+ ok(r == ERROR_SUCCESS, "cost init failed\n");
- static void test_appsearch(void)
- {
- MSIHANDLE hpkg;
- UINT r;
- MSIHANDLE hdb;
- CHAR prop[MAX_PATH];
- DWORD size = MAX_PATH;
+ /* try TARGETDIR after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- hdb = create_package_db();
- ok ( hdb, "failed to create package database\n" );
+ /* try SourceDir after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = create_appsearch_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
+ /* try SOURCEDIR after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* source path does not exist, but the property exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ todo_wine
+ {
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+ }
- r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
- ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
+ /* try SubDir after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- r = create_reglocator_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
+ /* try SubDir2 after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
+ ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
- r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
- ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
+ r = MsiDoAction(hpkg, "ResolveSource");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- r = create_signature_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
+ /* try TARGETDIR after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
- ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
+ /* try SourceDir after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- hpkg = package_from_db( hdb );
- ok( hpkg, "failed to create package\n");
+ /* try SOURCEDIR after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* source path does not exist, but the property exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- MsiCloseHandle( hdb );
+ /* try SubDir after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- r = MsiDoAction( hpkg, "AppSearch" );
- ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
+ /* try SubDir2 after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
+ ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
- r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
- ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
- ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
+ r = MsiDoAction(hpkg, "FileCost");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- MsiCloseHandle( hpkg );
- DeleteFileA(msifile);
- }
+ /* try TARGETDIR after FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- static void test_featureparents(void)
- {
- MSIHANDLE hpkg;
- UINT r;
- MSIHANDLE hdb;
- INSTALLSTATE state, action;
+ /* try SourceDir after FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- hdb = create_package_db();
- ok ( hdb, "failed to create package database\n" );
+ /* try SOURCEDIR after FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* source path does not exist, but the property exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
- ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
+ /* try SubDir after FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- r = create_feature_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
+ /* try SubDir2 after FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
+ ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
- r = create_component_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
+ r = MsiDoAction(hpkg, "CostFinalize");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- r = create_feature_components_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
+ /* try TARGETDIR after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = create_file_table( hdb );
- ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
+ /* try SourceDir after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- /* msidbFeatureAttributesFavorLocal */
- r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
- ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ /* try SOURCEDIR after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* source path does not exist, but the property exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- /* msidbFeatureAttributesFavorSource */
- r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
- ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ /* try SubDir after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- /* msidbFeatureAttributesFavorLocal */
- r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
- ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ /* try SubDir2 after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
+ ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
- /* disabled because of install level */
- r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
- ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ /* nonexistent directory */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* NULL szPathBuf */
+ size = MAX_PATH;
+ r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- /* child feature of disabled feature */
- r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
- ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ /* NULL pcchPathBuf */
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
+ ok(r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
- /* component of disabled feature (install level) */
- r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ /* pcchPathBuf is 0 */
+ size = 0;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+
+ /* pcchPathBuf does not have room for NULL terminator */
+ size = lstrlenA(cwd);
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
+ ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
+ "Expected path with no backslash, got \"%s\"\n", path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+
+ /* pcchPathBuf has room for NULL terminator */
+ size = lstrlenA(cwd) + 1;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- /* component of disabled child feature (install level) */
- r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ MsiCloseHandle(hpkg);
- /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
- r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ /* compressed source */
- /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
- r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
- r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
- /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
- r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "failed to create package\n");
- /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
- r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ /* try TARGETDIR */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try SourceDir */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try SOURCEDIR */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* source path nor the property exist */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
+ ok(size == 0, "Expected 0, got %d\n", size);
- /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
- r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ /* try SubDir */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ /* try SubDir2 */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
+ ok(!lstrcmpA(path, "kiwi"),
+ "Expected path to be unchanged, got \"%s\"\n", path);
+ ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+
+ r = MsiDoAction(hpkg, "CostInitialize");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
- r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ /* try TARGETDIR after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
- r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
- ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
+ /* try SourceDir after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
- r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
+ /* try SOURCEDIR after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ todo_wine
+ {
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+ }
- r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* source path does not exist, but the property exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ todo_wine
+ {
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+ }
- r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SubDir after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SubDir2 after CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = MsiDoAction(hpkg, "ResolveSource");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try TARGETDIR after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SourceDir after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'orion', 'leo'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SOURCEDIR after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ todo_wine
+ {
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+ }
- r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* source path and the property exist */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'orion', 'libra'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SubDir after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SubDir2 after ResolveSource */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = MsiDoAction(hpkg, "FileCost");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try TARGETDIR after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'orion', 'canis'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SourceDir after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SOURCEDIR after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ todo_wine
+ {
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+ }
- r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* source path and the property exist */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SubDir after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
- ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ /* try SubDir2 after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = MsiDoAction(hpkg, "CostFinalize");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ /* try TARGETDIR after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ /* try SourceDir after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ /* try SOURCEDIR after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
+ todo_wine
+ {
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
+ }
- r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ /* source path and the property exist */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ /* try SubDir after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ /* try SubDir2 after CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
+ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
- r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ MsiCloseHandle(hpkg);
+ DeleteFile(msifile);
+ }
- r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ static void test_shortlongsource(void)
+ {
+ MSIHANDLE hdb, hpkg;
+ CHAR path[MAX_PATH];
+ CHAR cwd[MAX_PATH];
+ CHAR subsrc[MAX_PATH];
+ DWORD size;
+ UINT r;
- r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ lstrcpyA(cwd, CURR_DIR);
+ lstrcatA(cwd, "\\");
- r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
- ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "long");
+ lstrcatA(subsrc, "\\");
- hpkg = package_from_db( hdb );
- ok( hpkg, "failed to create package\n");
+ /* long file names */
- MsiCloseHandle( hdb );
+ hdb = create_package_db();
+ ok( hdb, "failed to create database\n");
- r = MsiDoAction( hpkg, "CostInitialize");
- ok( r == ERROR_SUCCESS, "cost init failed\n");
+ set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
- r = MsiDoAction( hpkg, "FileCost");
- ok( r == ERROR_SUCCESS, "file cost failed\n");
+ r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
+ ok(r == S_OK, "failed\n");
- r = MsiDoAction( hpkg, "CostFinalize");
- ok( r == ERROR_SUCCESS, "cost finalize failed\n");
+ r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+ /* CostInitialize:short */
+ r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
+ /* CostInitialize:long */
+ r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "orion", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+ /* FileCost:short */
+ r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "waters", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ /* FileCost:long */
+ r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
+ /* CostFinalize:short */
+ r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "leo", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
+ /* CostFinalize:long */
+ r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
+ ok(r == S_OK, "failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "virgo", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
+ MsiDatabaseCommit(hdb);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "libra", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
+ hpkg = package_from_db(hdb);
+ ok(hpkg, "failed to create package\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
+ MsiCloseHandle(hdb);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
+ CreateDirectoryA("one", NULL);
+ CreateDirectoryA("four", NULL);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
+ r = MsiDoAction(hpkg, "CostInitialize");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "canis", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
+ CreateDirectory("five", NULL);
+ CreateDirectory("eight", NULL);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
+ r = MsiDoAction(hpkg, "FileCost");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "lepus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
+ CreateDirectory("nine", NULL);
+ CreateDirectory("twelve", NULL);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
+ r = MsiDoAction(hpkg, "CostFinalize");
+ ok(r == ERROR_SUCCESS, "file cost failed\n");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
+ /* neither short nor long source directories exist */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
- ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
+ CreateDirectoryA("short", NULL);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
+ /* short source directory exists */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
+ CreateDirectoryA("long", NULL);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetFeatureState(hpkg, "orion", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
- ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
+ /* both short and long source directories exist */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "leo", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "two");
+ lstrcatA(subsrc, "\\");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "virgo", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
+ /* short dir exists before CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "libra", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "four");
+ lstrcatA(subsrc, "\\");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
+ /* long dir exists before CostInitialize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "six");
+ lstrcatA(subsrc, "\\");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
+ /* short dir exists before FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "canis", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "eight");
+ lstrcatA(subsrc, "\\");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
+ /* long dir exists before FileCost */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "lepus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "ten");
+ lstrcatA(subsrc, "\\");
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
+ /* short dir exists before CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
+
+ lstrcpyA(subsrc, cwd);
+ lstrcatA(subsrc, "twelve");
+ lstrcatA(subsrc, "\\");
+
+ /* long dir exists before CostFinalize */
+ size = MAX_PATH;
+ lstrcpyA(path, "kiwi");
+ r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
+ ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
- state = 0xdeadbee;
- action = 0xdeadbee;
- r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
- ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
- ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
- ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
-
MsiCloseHandle(hpkg);
- DeleteFileA(msifile);
- }
+ RemoveDirectoryA("short");
+ RemoveDirectoryA("long");
+ RemoveDirectoryA("one");
+ RemoveDirectoryA("four");
+ RemoveDirectoryA("five");
+ RemoveDirectoryA("eight");
+ RemoveDirectoryA("nine");
+ RemoveDirectoryA("twelve");
- static void test_installprops(void)
- {
- MSIHANDLE hpkg, hdb;
- CHAR path[MAX_PATH];
- CHAR buf[MAX_PATH];
- DWORD size, type;
- LANGID langid;
- HKEY hkey1, hkey2;
- int res;
- UINT r;
+ /* short file names */
- GetCurrentDirectory(MAX_PATH, path);
- lstrcat(path, "\\");
- lstrcat(path, msifile);
+ r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- hdb = create_package_db();
- ok( hdb, "failed to create database\n");
+ set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
hpkg = package_from_db(hdb);
- ok( hpkg, "failed to create package\n");
+ ok(hpkg, "failed to create package\n");
MsiCloseHandle(hdb);
test_launchconditions();
test_ccpsearch();
test_complocator();
- }
+ test_MsiGetSourcePath();
+ test_shortlongsource();
+ test_sourcedir();
+ test_access();
+ test_emptypackage();
+ test_MsiGetProductProperty();
+ test_MsiSetProperty();
+ test_MsiApplyMultiplePatches();
+ test_MsiApplyPatch();
+
+ if (pSRSetRestorePointA && ret)
+ {
+ ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
+ if (ret)
+ remove_restore_point(status.llSequenceNumber);
++}
}
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 1, &id, NULL, &labelsz,
NULL, &promptsz);
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
+ if (r == ERROR_SUCCESS)
+ {
- ok(id == 2, "Expected 2, got %d\n", id);
- ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
- ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
+ ok(id == 2, "Expected 2, got %d\n", id);
+ ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
+ ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
+ }
/* now fill in the values */
id = 0xbeef;
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 1, &id, label, &labelsz,
prompt, &promptsz);
- ok(r == ERROR_INVALID_PARAMETER,
- "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
+ ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
+ if (r == ERROR_SUCCESS)
+ {
+ ok(id == 2, "Expected 2, got %d\n", id);
+ ok(!lstrcmpA(label, "one"), "Expected \"one\", got \"%s\"\n", label);
+ ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
+ ok(!lstrcmpA(prompt, "two"), "Expected \"two\", got \"%s\"\n", prompt);
+ ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
+ }
+ else if (r == ERROR_INVALID_PARAMETER)
+ {
- ok(id == 0xbeef, "Expected 0xbeef, got %d\n", id);
- ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
- ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %d\n", labelsz);
- ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
- ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %d\n", promptsz);
+ ok(id == 0xbeef, "Expected 0xbeef, got %d\n", id);
+ ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
+ ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %d\n", labelsz);
+ ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
+ ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %d\n", promptsz);
+ }
res = RegSetValueExA(media, "4", 0, REG_SZ, (LPBYTE)"three;four", 11);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 0, &id, NULL, &labelsz,
prompt, &promptsz);
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
+ if (r == ERROR_SUCCESS)
+ {
- ok(id == 1, "Expected 1, got %d\n", id);
- ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
- ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
- ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
+ ok(id == 1, "Expected 1, got %d\n", id);
+ ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
+ ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
+ ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
+ }
/* szVolumeLabel and pcchVolumeLabel are NULL */
id = 0;
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 0, &id, label, NULL,
prompt, &promptsz);
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
+ if (r == ERROR_SUCCESS)
+ {
- ok(id == 1, "Expected 1, got %d\n", id);
- ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
- ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
- ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
+ ok(id == 1, "Expected 1, got %d\n", id);
+ ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
+ ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
+ ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
+ }
/* szDiskPrompt is NULL */
id = 0;
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 0, &id, label, &labelsz,
NULL, &promptsz);
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS, got %d\n", r);
+ if (r == ERROR_SUCCESS)
+ {
- ok(id == 1, "Expected 1, got %d\n", id);
- ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label);
- ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
- ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
+ ok(id == 1, "Expected 1, got %d\n", id);
+ ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label);
+ ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
+ ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
+ }
/* szDiskPrompt and pcchDiskPrompt are NULL */
id = 0;
prompt, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id);
- todo_wine
- {
- ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
- ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
- ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
- ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
+ ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
+ ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
+ ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
+ ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
- }
RegDeleteValueA(media, "1");
RegDeleteValueA(media, "2");
/* MACHINENAME\username */
size = MAX_PATH;
- GetComputerNameA(username, &size);
- lstrcatA(username, "\\");
- ptr = username + lstrlenA(username);
+ if (pGetUserNameExA != NULL)
+ pGetUserNameExA(NameSamCompatible, username, &size);
+ else
+ {
- size = MAX_PATH;
+ GetComputerNameA(username, &size);
+ lstrcatA(username, "\\");
+ ptr = username + lstrlenA(username);
- GetUserNameA(ptr, &size);
+ size = MAX_PATH - (ptr - username);
+ GetUserNameA(ptr, &size);
+ }
+ trace("username: %s\n", username);
/* GetLastError is not set by the function */
#include <process.h>
#include <errno.h>
+ typedef struct
+ {
+ const char* buffer;
+ const char* drive;
+ const char* dir;
+ const char* file;
+ const char* ext;
+ const char* expected;
+ } makepath_case;
+
+ #define USE_BUFF ((char*)~0ul)
+ static const makepath_case makepath_cases[] =
+ {
+ { NULL, NULL, NULL, NULL, NULL, "" }, /* 0 */
+ { NULL, "c", NULL, NULL, NULL, "c:" },
+ { NULL, "c:", NULL, NULL, NULL, "c:" },
+ { NULL, "c:\\", NULL, NULL, NULL, "c:" },
+ { NULL, NULL, "dir", NULL, NULL, "dir\\" },
+ { NULL, NULL, "dir\\", NULL, NULL, "dir\\" },
+ { NULL, NULL, "\\dir", NULL, NULL, "\\dir\\" },
+ { NULL, NULL, NULL, "file", NULL, "file" },
+ { NULL, NULL, NULL, "\\file", NULL, "\\file" },
+ { NULL, NULL, NULL, "file", NULL, "file" },
+ { NULL, NULL, NULL, NULL, "ext", ".ext" }, /* 10 */
+ { NULL, NULL, NULL, NULL, ".ext", ".ext" },
+ { "foo", NULL, NULL, NULL, NULL, "" },
+ { "foo", USE_BUFF, NULL, NULL, NULL, "f:" },
+ { "foo", NULL, USE_BUFF, NULL, NULL, "foo\\" },
+ { "foo", NULL, NULL, USE_BUFF, NULL, "foo" },
+ { "foo", NULL, USE_BUFF, "file", NULL, "foo\\file" },
+ { "foo", NULL, USE_BUFF, "file", "ext", "foo\\file.ext" },
+ { "foo", NULL, NULL, USE_BUFF, "ext", "foo.ext" },
+ /* remaining combinations of USE_BUFF crash native */
+ { NULL, "c", "dir", "file", "ext", "c:dir\\file.ext" },
+ { NULL, "c:", "dir", "file", "ext", "c:dir\\file.ext" }, /* 20 */
+ { NULL, "c:\\", "dir", "file", "ext", "c:dir\\file.ext" }
+ };
+
static void test_makepath(void)
{
+ WCHAR driveW[MAX_PATH];
+ WCHAR dirW[MAX_PATH];
+ WCHAR fileW[MAX_PATH];
+ WCHAR extW[MAX_PATH];
+ WCHAR bufferW[MAX_PATH];
char buffer[MAX_PATH];
- _makepath(buffer, "C", "\\foo", "dummy", "txt");
- ok( strcmp(buffer, "C:\\foo\\dummy.txt") == 0, "unexpected result: %s\n", buffer);
- _makepath(buffer, "C:", "\\foo\\", "dummy", ".txt");
- ok( strcmp(buffer, "C:\\foo\\dummy.txt") == 0, "unexpected result: %s\n", buffer);
+ unsigned int i, n;
+
+ for (i = 0; i < sizeof(makepath_cases)/sizeof(makepath_cases[0]); ++i)
+ {
+ const makepath_case* p = &makepath_cases[i];
+
+ memset(buffer, 'X', MAX_PATH);
+ if (p->buffer)
+ strcpy(buffer, p->buffer);
- /* this works with native and e.g. Freelancer depends on it */
- strcpy(buffer, "foo");
- _makepath(buffer, NULL, buffer, "dummy.txt", NULL);
- ok( strcmp(buffer, "foo\\dummy.txt") == 0, "unexpected result: %s\n", buffer);
+ /* Ascii */
+ _makepath(buffer,
+ p->drive == USE_BUFF ? buffer : p->drive,
+ p->dir == USE_BUFF ? buffer : p->dir,
+ p->file == USE_BUFF? buffer : p->file,
+ p->ext == USE_BUFF ? buffer : p->ext);
+
+ buffer[MAX_PATH - 1] = '\0';
+ ok(!strcmp(p->expected, buffer), "got '%s' for case %d\n", buffer, i);
+
+ /* Unicode */
+ if (p->drive != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->drive, -1, driveW, MAX_PATH);
+ if (p->dir != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->dir, -1, dirW, MAX_PATH);
+ if (p->file != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->file, -1, fileW, MAX_PATH);
+ if (p->ext != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->ext, -1, extW, MAX_PATH);
+
+ memset(buffer, 0, MAX_PATH);
+ for (n = 0; n < MAX_PATH; ++n)
+ bufferW[n] = 'X';
+ if (p->buffer) MultiByteToWideChar( CP_ACP, 0, p->buffer, -1, bufferW, MAX_PATH);
+
+ _wmakepath(bufferW,
+ p->drive == USE_BUFF ? bufferW : p->drive ? driveW : NULL,
+ p->dir == USE_BUFF ? bufferW : p->dir ? dirW : NULL,
+ p->file == USE_BUFF? bufferW : p->file ? fileW : NULL,
+ p->ext == USE_BUFF ? bufferW : p->ext ? extW : NULL);
+
+ bufferW[MAX_PATH - 1] = '\0';
+ WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, MAX_PATH, NULL, NULL);
+ ok(!strcmp(p->expected, buffer), "got '%s' for unicode case %d\n", buffer, i);
- }
++}
}
static void test_fullpath(void)
ok( ret == -1 && errno == EBADF,
"Wrong write result in child process on %d (%s)\n", fd, strerror(errno));
}
-
+
+ static void create_io_inherit_block( STARTUPINFO *startup, unsigned int count, const HANDLE *handles )
+ {
+ static BYTE block[1024];
+ BYTE *wxflag_ptr;
+ HANDLE *handle_ptr;
+ unsigned int i;
+
+ startup->lpReserved2 = block;
+ startup->cbReserved2 = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * count;
+ wxflag_ptr = block + sizeof(unsigned);
+ handle_ptr = (HANDLE *)(wxflag_ptr + count);
+
+ *(unsigned*)block = count;
+ for (i = 0; i < count; i++)
+ {
+ wxflag_ptr[i] = 0x81;
+ handle_ptr[i] = handles[i];
+ }
+ }
+
+ static const char *read_file( HANDLE file )
+ {
+ static char buffer[128];
+ DWORD ret;
+ SetFilePointer( file, 0, NULL, FILE_BEGIN );
+ if (!ReadFile( file, buffer, sizeof(buffer) - 1, &ret, NULL)) ret = 0;
+ buffer[ret] = 0;
+ return buffer;
+ }
+
+ static void test_stdout_handle( STARTUPINFO *startup, char *cmdline, HANDLE hstdout, BOOL expect_stdout,
+ const char *descr )
+ {
+ const char *data;
+ HANDLE hErrorFile;
+ SECURITY_ATTRIBUTES sa;
+ PROCESS_INFORMATION proc;
+
+ /* make file handle inheritable */
+ sa.nLength = sizeof(sa);
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE;
+
+ hErrorFile = CreateFileA( "fdopen.err", GENERIC_READ|GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, CREATE_ALWAYS, 0, NULL );
+ startup->dwFlags = STARTF_USESTDHANDLES;
+ startup->hStdInput = GetStdHandle( STD_INPUT_HANDLE );
+ startup->hStdOutput = hErrorFile;
+ startup->hStdError = GetStdHandle( STD_ERROR_HANDLE );
+
+ CreateProcessA( NULL, cmdline, NULL, NULL, TRUE,
+ CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS, NULL, NULL, startup, &proc );
+ winetest_wait_child_process( proc.hProcess );
+
+ data = read_file( hErrorFile );
+ if (expect_stdout)
+ ok( strcmp( data, "Success" ), "%s: Error file shouldn't contain data\n", descr );
+ else
+ ok( !strcmp( data, "Success" ), "%s: Wrong error data (%s)\n", descr, data );
+
+ if (hstdout)
+ {
+ data = read_file( hstdout );
+ if (expect_stdout)
+ ok( !strcmp( data, "Success" ), "%s: Wrong stdout data (%s)\n", descr, data );
+ else
+ ok( strcmp( data, "Success" ), "%s: Stdout file shouldn't contain data\n", descr );
+ }
+
+ CloseHandle( hErrorFile );
+ DeleteFile( "fdopen.err" );
+ }
+
static void test_file_inherit( const char* selfname )
{
int fd;
fd = open("stat.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD |_S_IWRITE);
if (fd >= 0)
{
- if (fstat(fd, &buf) == 0)
- {
- if ((buf.st_mode & _S_IFMT) == _S_IFREG)
- {
+ ok(fstat(fd, &buf) == 0, "fstat failed: errno=%d\n", errno);
+ ok((buf.st_mode & _S_IFMT) == _S_IFREG, "bad format = %06o\n", buf.st_mode);
+ ok((buf.st_mode & 0777) == 0666, "bad st_mode = %06o\n", buf.st_mode);
- ok(buf.st_dev == 0, "st_dev is %d, expected 0\n", buf.st_dev);
+ ok(buf.st_dev == 0, "st_dev is %d, expected 0\n", buf.st_dev);
- ok(buf.st_dev == buf.st_rdev, "st_dev (%d) and st_rdev (%d) differ\n",
- buf.st_dev, buf.st_rdev);
- ok(buf.st_nlink == 1, "st_nlink is %d, expected 1\n",
- buf.st_nlink);
- ok(buf.st_size == 0, "st_size is %d, expected 0\n",
- buf.st_size);
- }
- else
- skip("file is not a file?\n");
- }
- else
- skip("fstat failed, errno %d\n", errno);
+ ok(buf.st_dev == buf.st_rdev, "st_dev (%d) and st_rdev (%d) differ\n", buf.st_dev, buf.st_rdev);
+ ok(buf.st_nlink == 1, "st_nlink is %d, expected 1\n", buf.st_nlink);
+ ok(buf.st_size == 0, "st_size is %d, expected 0\n", buf.st_size);
+
+ ok(stat("stat.tst", &buf) == 0, "stat failed: errno=%d\n", errno);
+ ok((buf.st_mode & _S_IFMT) == _S_IFREG, "bad format = %06o\n", buf.st_mode);
+ ok((buf.st_mode & 0777) == 0666, "bad st_mode = %06o\n", buf.st_mode);
+ ok(buf.st_dev == buf.st_rdev, "st_dev (%d) and st_rdev (%d) differ\n", buf.st_dev, buf.st_rdev);
+ ok(buf.st_nlink == 1, "st_nlink is %d, expected 1\n", buf.st_nlink);
+ ok(buf.st_size == 0, "st_size is %d, expected 0\n", buf.st_size);
+
close(fd);
remove("stat.tst");
}
/* Tests for a char device */
if (_dup2(0, 10) == 0)
{
- if (fstat(10, &buf) == 0)
+ ok(fstat(10, &buf) == 0, "fstat(stdin) failed: errno=%d\n", errno);
+ if ((buf.st_mode & _S_IFMT) == _S_IFCHR)
{
- if (buf.st_mode == _S_IFCHR)
- {
+ ok(buf.st_mode == _S_IFCHR, "bad st_mode=%06o\n", buf.st_mode);
- ok(buf.st_dev == 10, "st_dev is %d, expected 10\n", buf.st_dev);
- ok(buf.st_rdev == 10, "st_rdev is %d, expected 10\n", buf.st_rdev);
- ok(buf.st_nlink == 1, "st_nlink is %d, expected 1\n", buf.st_nlink);
- }
- else
+ ok(buf.st_dev == 10, "st_dev is %d, expected 10\n", buf.st_dev);
+ ok(buf.st_rdev == 10, "st_rdev is %d, expected 10\n", buf.st_rdev);
+ ok(buf.st_nlink == 1, "st_nlink is %d, expected 1\n", buf.st_nlink);
+ }
+ else
- skip("stdin is not a char device?\n");
- }
- else
- skip("fstat failed with errno %d\n", errno);
+ skip("stdin is not a char device? st_mode=%06o\n", buf.st_mode);
close(10);
}
else
ok(!strcmp(buffer,"1 "),"Character zero-padded and/or not left-adjusted \"%s\"\n",buffer);
ok( r==4, "return count wrong\n");
- format = "%p";
- r = sprintf(buffer,format,(void *)57);
+ if (sizeof(void *) == 8)
+ {
- ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
- ok( r==8, "return count wrong\n");
+ format = "%p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
+ ok( r==16, "return count wrong\n");
+
+ format = "%#020p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer," 0X0000000000000039"),"Pointer formatted incorrectly\n");
+ ok( r==20, "return count wrong\n");
+
+ format = "%Fp";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
+ ok( r==16, "return count wrong\n");
+
+ format = "%#-020p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0X0000000000000039 "),"Pointer formatted incorrectly\n");
+ ok( r==20, "return count wrong\n");
+ }
+ else
+ {
+ format = "%p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
+ ok( r==8, "return count wrong\n");
- format = "%#012p";
- r = sprintf(buffer,format,(void *)57);
- ok(!strcmp(buffer," 0X00000039"),"Pointer formatted incorrectly\n");
- ok( r==12, "return count wrong\n");
+ format = "%#012p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer," 0X00000039"),"Pointer formatted incorrectly\n");
+ ok( r==12, "return count wrong\n");
- format = "%Fp";
- r = sprintf(buffer,format,(void *)57);
- ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
- ok( r==8, "return count wrong\n");
+ format = "%Fp";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
+ ok( r==8, "return count wrong\n");
+ format = "%#-012p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted incorrectly\n");
+ ok( r==12, "return count wrong\n");
+ }
+
format = "%04s";
r = sprintf(buffer,format,"foo");
ok(!strcmp(buffer,"0foo"),"String not zero-prefixed \"%s\"\n",buffer);
format = "asdf%n";
x = 0;
r = sprintf(buffer, format, &x );
- ok(x == 4, "should write to x\n");
+ if (r == -1)
+ {
+ /* %n format is disabled by default on vista */
+ /* FIXME: should test with _set_printf_count_output */
+ ok(x == 0, "should not write to x: %d\n", x);
+ }
+ else
+ {
+ ok(x == 4, "should write to x: %d\n", x);
- ok(!strcmp(buffer,"asdf"), "failed\n");
+ ok(!strcmp(buffer,"asdf"), "failed\n");
- ok( r==4, "return count wrong\n");
+ ok( r==4, "return count wrong: %d\n", r);
+ }
format = "%-1d";
r = sprintf(buffer, format,2);
format = "%p";
r = sprintf(buffer, format,0);
- ok(!strcmp(buffer,"00000000"), "failed\n");
- ok( r==8, "return count wrong\n");
+ if (sizeof(void *) == 8)
+ {
+ ok(!strcmp(buffer,"0000000000000000"), "failed\n");
+ ok( r==16, "return count wrong\n");
+ }
+ else
+ {
+ ok(!strcmp(buffer,"00000000"), "failed\n");
+ ok( r==8, "return count wrong\n");
+ }
format = "%s";
r = sprintf(buffer, format,0);
const wchar_t hs[] = {'%', 'h', 's', 0};
swprintf(buffer,TwentyThreePoint15e,pnumber);
- todo_wine
- {
- ok(wcsstr(buffer,e008) != 0,"Sprintf different\n");
+ ok(wcsstr(buffer,e008) != 0,"Sprintf different\n");
- }
swprintf(buffer,I64d,((ULONGLONG)0xffffffff)*0xffffffff);
ok(wcslen(buffer) == 11,"Problem with long long\n");
swprintf(buffer,S,string);
struct tm my_tm, sav_tm;
time_t nulltime, local_time;
char TZ_env[256];
- int secs;
+ char buffer[64];
+ int year;
+ time_t ref, secs;
+
+ year = get_test_year( &ref );
+ ref += SECSPERDAY;
ok (res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
+ WideCharToMultiByte( CP_ACP, 0, tzinfo.StandardName, -1, buffer, sizeof(buffer), NULL, NULL );
+ trace( "bias %d std %d dst %d zone %s\n",
+ tzinfo.Bias, tzinfo.StandardBias, tzinfo.DaylightBias, buffer );
/* Bias may be positive or negative, to use offset of one day */
- secs = SECSPERDAY - tzinfo.Bias * SECSPERMIN;
+ my_tm = *localtime(&ref); /* retrieve current dst flag */
+ secs= SECSPERDAY - tzinfo.Bias * SECSPERMIN;
+ secs -= (my_tm.tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN;
my_tm.tm_mday = 1 + secs/SECSPERDAY;
secs = secs % SECSPERDAY;
my_tm.tm_hour = secs / SECSPERHOUR;
secs = secs % SECSPERMIN;
my_tm.tm_sec = secs;
- my_tm.tm_year = 70;
+ my_tm.tm_year = year;
my_tm.tm_mon = 0;
- my_tm.tm_isdst= 0;
sav_tm = my_tm;
-
+
local_time = mktime(&my_tm);
- ok(((DWORD)local_time == SECSPERDAY), "mktime returned %u, expected %u\n",
- (DWORD)local_time, SECSPERDAY);
+ ok(local_time == ref, "mktime returned %u, expected %u\n",
+ (DWORD)local_time, (DWORD)ref);
/* now test some unnormalized struct tm's */
my_tm = sav_tm;
my_tm.tm_sec += 60;
char TZ_env[256];
struct tm* lt;
-
+ int year = get_test_year( &ref );
+ int is_leap = !(year % 4) && ((year % 100) || !((year + 300) % 400));
+
+ gmt = ref + SECSPERDAY + tzinfo.Bias * SECSPERMIN;
ok (res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
lt = localtime(&gmt);
- ok(((lt->tm_year == 70) && (lt->tm_mon == 0) && (lt->tm_yday == 1) &&
- (lt->tm_mday == 2) && (lt->tm_wday == 5) && (lt->tm_hour == 0) &&
- (lt->tm_min == 0) && (lt->tm_sec == 0) && (lt->tm_isdst == 0)),
+ gmt += (lt->tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN;
+ lt = localtime(&gmt);
+ ok(((lt->tm_year == year) && (lt->tm_mon == 0) && (lt->tm_yday == 1) &&
+ (lt->tm_mday == 2) && (lt->tm_hour == 0) &&
+ (lt->tm_min == 0) && (lt->tm_sec == 0)),
"Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour,
lt->tm_min, lt->tm_sec, lt->tm_isdst);
ok(pNetApiBufferSize(NULL, &dwSize) == ERROR_INVALID_PARAMETER, "Error for NULL pointer\n");
/* border reallocate cases */
- ok(pNetApiBufferReallocate(0, 1500, (LPVOID *) &p) == NERR_Success, "Reallocate with OldBuffer = NULL failed\n");
+ ok(pNetApiBufferReallocate(0, 1500, &p) == NERR_Success, "Reallocate with OldBuffer = NULL failed\n");
ok(p != NULL, "No memory got allocated\n");
- ok(pNetApiBufferAllocate(1024, (LPVOID *)&p) == NERR_Success, "Memory not reserved\n");
- ok(pNetApiBufferReallocate(p, 0, (LPVOID *) &p) == NERR_Success, "Not freed\n");
+ ok(pNetApiBufferAllocate(1024, &p) == NERR_Success, "Memory not reserved\n");
+ ok(pNetApiBufferReallocate(p, 0, &p) == NERR_Success, "Not freed\n");
ok(p == NULL, "Pointer not cleared\n");
-
+
/* 0-length buffer */
- ok(pNetApiBufferAllocate(0, (LPVOID *)&p) == NERR_Success,
+ ok(pNetApiBufferAllocate(0, &p) == NERR_Success,
"Reserved memory\n");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size\n");
ok(dwSize < 0xFFFFFFFF, "The size of the 0-length buffer\n");
}
if (init_wksta_tests()) {
- run_get_comp_name_tests();
+ if (pNetpGetComputerName)
+ run_get_comp_name_tests();
+ else
+ win_skip("Function NetpGetComputerName not available\n");
run_wkstausergetinfo_tests();
run_wkstatransportenum_tests();
}
ATOM_BASIC_INFORMATION* abi = (ATOM_BASIC_INFORMATION*)ptr;
ULONG ptr_size = sizeof(ATOM_BASIC_INFORMATION) + 255 * sizeof(WCHAR);
- res = pNtAddAtom(testAtom1, lstrlenW(testAtom1) * sizeof(WCHAR), &atom);
+ if (pNtAddAtomNT4)
+ res = pNtAddAtomNT4(testAtom1, &atom);
+ else
+ res = pNtAddAtom(testAtom1, lstrlenW(testAtom1) * sizeof(WCHAR), &atom);
+
ok(!res, "Added atom (%x)\n", res);
memset(abi->Name, 0xcc, 255 * sizeof(WCHAR));
iosb.Information = 0xdeadbeef;
offset.QuadPart = strlen(text) + 2;
status = pNtReadFile( handle, event, apc, &apc_count, &iosb, buffer, 2, &offset, NULL );
- ok( status == STATUS_END_OF_FILE, "wrong status %x\n", status );
- ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
- ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
- ok( !is_signaled( event ), "event is signaled\n" );
- ok( !apc_count, "apc was called\n" );
- SleepEx( 1, TRUE ); /* alertable sleep */
- ok( !apc_count, "apc was called\n" );
+ if (status == STATUS_PENDING) /* vista */
+ {
+ ok( U(iosb).Status == STATUS_END_OF_FILE, "wrong status %x\n", U(iosb).Status );
+ ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
+ ok( is_signaled( event ), "event is signaled\n" );
+ ok( !apc_count, "apc was called\n" );
+ SleepEx( 1, TRUE ); /* alertable sleep */
+ ok( apc_count == 1, "apc was not called\n" );
+ }
+ else
+ {
+ ok( status == STATUS_END_OF_FILE, "wrong status %x\n", status );
+ ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
+ ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
+ ok( !is_signaled( event ), "event is signaled\n" );
+ ok( !apc_count, "apc was called\n" );
+ SleepEx( 1, TRUE ); /* alertable sleep */
+ ok( !apc_count, "apc was called\n" );
+ }
CloseHandle( handle );
/* now a non-overlapped file */
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_DWORD32(void)
{
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
ok( sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) == ReturnLength,
"Inconsistent length %d\n", ReturnLength);
-
+ ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
+ ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
+ ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
+
/* Try it for all processors */
+ sppi->KernelTime.QuadPart = 0xdeaddead;
+ sppi->UserTime.QuadPart = 0xdeaddead;
+ sppi->IdleTime.QuadPart = 0xdeaddead;
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength, &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
ok( NeededLength == ReturnLength, "Inconsistent length (%d) <-> (%d)\n", NeededLength, ReturnLength);
SystemInformationLength = ReturnLength;
shi = HeapReAlloc(GetProcessHeap(), 0, shi , SystemInformationLength);
status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
- ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
+ if (status != STATUS_INFO_LENGTH_MISMATCH) /* vista */
+ {
+ ok( status == STATUS_SUCCESS,
+ "Expected STATUS_SUCCESS, got %08x\n", status);
- /* Check if we have some return values */
- trace("Number of Handles : %d\n", shi->Count);
- todo_wine
- {
- /* our implementation is a stub for now */
- ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
- }
+ /* Check if we have some return values */
+ trace("Number of Handles : %d\n", shi->Count);
+ todo_wine
+ {
+ /* our implementation is a stub for now */
+ ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
+ }
-
+ }
HeapFree( GetProcessHeap(), 0, shi);
}
/* illegal remote address */
todo_wine{
status = pNtReadVirtualMemory(process, (void *) 0x1234, buffer, 12, &readcount);
- ok( status == STATUS_PARTIAL_COPY, "Expected STATUS_PARTIAL_COPY, got %08x\n", status);
+ ok( status == STATUS_PARTIAL_COPY || broken(status == STATUS_ACCESS_VIOLATION), "Expected STATUS_PARTIAL_COPY, got %08x\n", status);
+ if (status == STATUS_PARTIAL_COPY)
- ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
+ ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
}
/* 0 handle */
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="ntdll_winetest" type="win32cui" installbase="bin" installname="ntdll_winetest.exe" allowwarnings="true">
- <include base="ntdll_winetest">.</include>
+ <include base="ntdll_winetest">.</include>
- <define name="__USE_W32API" />
- <define name="_WIN32_WINNT">0x0600</define>
- <define name="WINVER">0x609</define>
- <library>kernel32</library>
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
- <file>atom.c</file>
- <file>change.c</file>
- <file>env.c</file>
- <file>error.c</file>
- <file>exception.c</file>
- <file>file.c</file>
- <file>info.c</file>
- <file>large_int.c</file>
- <file>om.c</file>
- <file>path.c</file>
- <file>port.c</file>
- <file>reg.c</file>
- <file>rtlbitmap.c</file>
- <file>rtl.c</file>
- <file>rtlstr.c</file>
- <file>string.c</file>
- <file>time.c</file>
- <file>testlist.c</file>
+ <library>ntdll</library>
+ <file>atom.c</file>
+ <file>change.c</file>
+ <file>env.c</file>
+ <file>error.c</file>
+ <file>exception.c</file>
+ <file>file.c</file>
+ <file>info.c</file>
+ <file>large_int.c</file>
+ <file>om.c</file>
+ <file>path.c</file>
+ <file>port.c</file>
+ <file>reg.c</file>
+ <file>rtlbitmap.c</file>
+ <file>rtl.c</file>
+ <file>rtlstr.c</file>
+ <file>string.c</file>
+ <file>time.c</file>
+ <file>testlist.c</file>
</module>
- </group>
pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
status = pNtOpenSymbolicLinkObject(&dir, SYMBOLIC_LINK_QUERY, &attr);
- ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status);
- pRtlFreeUnicodeString(&str);
- InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
- pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
- DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH)
- pRtlFreeUnicodeString(&str);
- pNtClose(h);
- pNtClose(dir);
+ is_nt4 = (status == STATUS_OBJECT_NAME_NOT_FOUND); /* nt4 doesn't have Local\\ symlink */
+ if (!is_nt4)
+ {
+ ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status);
+ pRtlFreeUnicodeString(&str);
+ InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
+ pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
+ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH)
+ pRtlFreeUnicodeString(&str);
+ pNtClose(h);
+ pNtClose(dir);
+ }
pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
pNtClose(dir);
- InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
- pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Global\\om.c-test");
- DIR_TEST_CREATE_SUCCESS(&dir)
- pRtlFreeUnicodeString(&str);
- pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local\\om.c-test\\one more level");
- DIR_TEST_CREATE_SUCCESS(&h)
- pRtlFreeUnicodeString(&str);
- pNtClose(h);
- InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
- pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
- DIR_TEST_CREATE_SUCCESS(&dir)
- pRtlFreeUnicodeString(&str);
- pNtClose(h);
- pNtClose(dir);
+ if (!is_nt4)
+ {
-
+ InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
+ pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Global\\om.c-test");
+ DIR_TEST_CREATE_SUCCESS(&dir)
+ pRtlFreeUnicodeString(&str);
+ pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local\\om.c-test\\one more level");
+ DIR_TEST_CREATE_SUCCESS(&h)
+ pRtlFreeUnicodeString(&str);
+ pNtClose(h);
+ InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
+ pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
+ DIR_TEST_CREATE_SUCCESS(&dir)
+ pRtlFreeUnicodeString(&str);
+ pNtClose(h);
-
+ pNtClose(dir);
+ }
/* Create other objects using RootDirectory */
{
hntdll = LoadLibraryA("ntdll.dll");
- if (hntdll)
- {
+ if (!hntdll)
+ return FALSE;
+
- pNtCompleteConnectPort = (void *)GetProcAddress(hntdll, "NtCompleteConnectPort");
- pNtAcceptConnectPort = (void *)GetProcAddress(hntdll, "NtAcceptConnectPort");
- pNtReplyPort = (void *)GetProcAddress(hntdll, "NtReplyPort");
- pNtReplyWaitReceivePort = (void *)GetProcAddress(hntdll, "NtReplyWaitReceivePort");
- pNtCreatePort = (void *)GetProcAddress(hntdll, "NtCreatePort");
- pNtRequestWaitReplyPort = (void *)GetProcAddress(hntdll, "NtRequestWaitReplyPort");
- pNtRequestPort = (void *)GetProcAddress(hntdll, "NtRequestPort");
- pNtRegisterThreadTerminatePort = (void *)GetProcAddress(hntdll, "NtRegisterThreadTerminatePort");
- pNtConnectPort = (void *)GetProcAddress(hntdll, "NtConnectPort");
- pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
- pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject");
+ pNtCompleteConnectPort = (void *)GetProcAddress(hntdll, "NtCompleteConnectPort");
+ pNtAcceptConnectPort = (void *)GetProcAddress(hntdll, "NtAcceptConnectPort");
+ pNtReplyPort = (void *)GetProcAddress(hntdll, "NtReplyPort");
+ pNtReplyWaitReceivePort = (void *)GetProcAddress(hntdll, "NtReplyWaitReceivePort");
+ pNtCreatePort = (void *)GetProcAddress(hntdll, "NtCreatePort");
+ pNtRequestWaitReplyPort = (void *)GetProcAddress(hntdll, "NtRequestWaitReplyPort");
+ pNtRequestPort = (void *)GetProcAddress(hntdll, "NtRequestPort");
+ pNtRegisterThreadTerminatePort = (void *)GetProcAddress(hntdll, "NtRegisterThreadTerminatePort");
+ pNtConnectPort = (void *)GetProcAddress(hntdll, "NtConnectPort");
+ pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
+ pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject");
- }
if (!pNtCompleteConnectPort || !pNtAcceptConnectPort ||
!pNtReplyWaitReceivePort || !pNtCreatePort || !pNtRequestWaitReplyPort ||
if (!init_function_ptrs())
return;
- myARGC = winetest_get_mainargs(&myARGV);
- strcpy(selfname, myARGV[0]);
+ pRtlInitUnicodeString(&port, PORTNAME);
- thread = CreateThread(NULL, 0, test_ports_client, NULL, 0, &id);
+ memset(&obj, 0, sizeof(OBJECT_ATTRIBUTES));
+ obj.Length = sizeof(OBJECT_ATTRIBUTES);
+ obj.ObjectName = &port;
+
+ status = pNtCreatePort(&port_handle, &obj, 100, 100, 0);
+ if (status == STATUS_ACCESS_DENIED) skip("Not enough rights\n");
+ else todo_wine ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %d\n", status);
+
+ if (status == STATUS_SUCCESS)
+ {
+ DWORD id;
+ HANDLE thread = CreateThread(NULL, 0, test_ports_client, NULL, 0, &id);
- ok(thread != NULL, "Expected non-NULL thread handle!\n");
+ ok(thread != NULL, "Expected non-NULL thread handle!\n");
- test_ports_server();
+ test_ports_server( port_handle );
+ ok( WaitForSingleObject( thread, 10000 ) == 0, "thread didn't exit\n" );
- CloseHandle(thread);
- }
+ CloseHandle(thread);
++}
+ FreeLibrary(hntdll);
}
trace("Could not load ntdll.dll\n");
return FALSE;
}
- if (hntdll)
- {
- NTDLL_GET_PROC(RtlCreateUnicodeStringFromAsciiz)
- NTDLL_GET_PROC(RtlCreateUnicodeString)
- NTDLL_GET_PROC(RtlFreeUnicodeString)
- NTDLL_GET_PROC(NtDeleteValueKey)
- NTDLL_GET_PROC(RtlQueryRegistryValues)
- NTDLL_GET_PROC(RtlCheckRegistryKey)
- NTDLL_GET_PROC(RtlOpenCurrentUser)
- NTDLL_GET_PROC(NtClose)
- NTDLL_GET_PROC(NtDeleteValueKey)
- NTDLL_GET_PROC(NtCreateKey)
- NTDLL_GET_PROC(NtFlushKey)
- NTDLL_GET_PROC(NtDeleteKey)
- NTDLL_GET_PROC(NtQueryValueKey)
- NTDLL_GET_PROC(NtSetValueKey)
- NTDLL_GET_PROC(NtOpenKey)
- NTDLL_GET_PROC(RtlFormatCurrentUserKeyPath)
- NTDLL_GET_PROC(RtlReAllocateHeap)
- NTDLL_GET_PROC(RtlAppendUnicodeToString)
- NTDLL_GET_PROC(RtlUnicodeStringToAnsiString)
- NTDLL_GET_PROC(RtlFreeHeap)
- NTDLL_GET_PROC(RtlAllocateHeap)
- NTDLL_GET_PROC(RtlZeroMemory)
- NTDLL_GET_PROC(RtlpNtQueryValueKey)
+ NTDLL_GET_PROC(RtlCreateUnicodeStringFromAsciiz)
+ NTDLL_GET_PROC(RtlCreateUnicodeString)
+ NTDLL_GET_PROC(RtlFreeUnicodeString)
+ NTDLL_GET_PROC(NtDeleteValueKey)
+ NTDLL_GET_PROC(RtlQueryRegistryValues)
+ NTDLL_GET_PROC(RtlCheckRegistryKey)
+ NTDLL_GET_PROC(RtlOpenCurrentUser)
+ NTDLL_GET_PROC(NtClose)
+ NTDLL_GET_PROC(NtDeleteValueKey)
+ NTDLL_GET_PROC(NtCreateKey)
+ NTDLL_GET_PROC(NtFlushKey)
+ NTDLL_GET_PROC(NtDeleteKey)
+ NTDLL_GET_PROC(NtQueryValueKey)
+ NTDLL_GET_PROC(NtSetValueKey)
+ NTDLL_GET_PROC(NtOpenKey)
+ NTDLL_GET_PROC(RtlFormatCurrentUserKeyPath)
+ NTDLL_GET_PROC(RtlReAllocateHeap)
+ NTDLL_GET_PROC(RtlAppendUnicodeToString)
+ NTDLL_GET_PROC(RtlUnicodeStringToAnsiString)
+ NTDLL_GET_PROC(RtlFreeHeap)
+ NTDLL_GET_PROC(RtlAllocateHeap)
+ NTDLL_GET_PROC(RtlZeroMemory)
+ NTDLL_GET_PROC(RtlpNtQueryValueKey)
- }
return TRUE;
}
#undef NTDLL_GET_PROC
value = 0xdeadbeef;
pRtlInitUnicodeString(&uni, wstr);
result = pRtlUnicodeStringToInteger(&uni, str2int[test_num].base, &value);
- ok(result == str2int[test_num].result,
- "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) has result %x, expected: %x\n",
- test_num, str2int[test_num].str, str2int[test_num].base, result, str2int[test_num].result);
- ok(value == str2int[test_num].value,
+ ok(result == str2int[test_num].result ||
+ (str2int[test_num].alternative && result == str2int[test_num].alternative),
+ "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) has result %x, expected: %x (%x)\n",
+ test_num, str2int[test_num].str, str2int[test_num].base, result,
+ str2int[test_num].result, str2int[test_num].alternative);
+ if (result == STATUS_SUCCESS)
+ ok(value == str2int[test_num].value ||
+ broken(str2int[test_num].str[0] == '\0' && str2int[test_num].base == 16), /* nt4 */
- "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
- test_num, str2int[test_num].str, str2int[test_num].base, value, str2int[test_num].value);
+ "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
+ test_num, str2int[test_num].str, str2int[test_num].base, value, str2int[test_num].value);
- free(wstr);
+ else
+ ok(value == 0xdeadbeef || value == 0 /* vista */,
+ "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected 0 or deadbeef\n",
+ test_num, str2int[test_num].str, str2int[test_num].base, value);
+ HeapFree(GetProcessHeap(), 0, wstr);
}
wstr = AtoW(str2int[1].str);
if (str2int[test_num].str[0] != '\0') {
value = 0xdeadbeef;
result = pRtlCharToInteger(str2int[test_num].str, str2int[test_num].base, &value);
- ok(result == str2int[test_num].result,
- "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) has result %x, expected: %x\n",
- test_num, str2int[test_num].str, str2int[test_num].base, result, str2int[test_num].result);
+ ok(result == str2int[test_num].result ||
+ (str2int[test_num].alternative && result == str2int[test_num].alternative),
+ "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) has result %x, expected: %x (%x)\n",
+ test_num, str2int[test_num].str, str2int[test_num].base, result,
+ str2int[test_num].result, str2int[test_num].alternative);
+ if (result == STATUS_SUCCESS)
- ok(value == str2int[test_num].value,
- "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
- test_num, str2int[test_num].str, str2int[test_num].base, value, str2int[test_num].value);
+ ok(value == str2int[test_num].value,
+ "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
+ test_num, str2int[test_num].str, str2int[test_num].base, value, str2int[test_num].value);
+ else
+ ok(value == 0 || value == 0xdeadbeef,
+ "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected 0 or deadbeef\n",
+ test_num, str2int[test_num].str, str2int[test_num].base, value);
}
}
for (test_num = 0; test_num < NB_STR2LONGLONG; test_num++) {
result = p_atoi64(str2longlong[test_num].str);
- ok(result == str2longlong[test_num].value,
- "(test %d): call failed: _atoi64(\"%s\") has result 0x%x%08x, expected: 0x%x%08x\n",
- test_num, str2longlong[test_num].str, (DWORD)(result >> 32), (DWORD)result,
- (DWORD)(str2longlong[test_num].value >> 32), (DWORD)str2longlong[test_num].value);
- }
+ if (str2longlong[test_num].overflow)
+ ok(result == str2longlong[test_num].value ||
+ (result == (str2longlong[test_num].overflow == -1) ?
+ ULL(0x80000000,0x00000000) : ULL(0x7fffffff,0xffffffff)),
+ "(test %d): call failed: _atoi64(\"%s\") has result 0x%x%08x, expected: 0x%x%08x\n",
+ test_num, str2longlong[test_num].str, (DWORD)(result >> 32), (DWORD)result,
+ (DWORD)(str2longlong[test_num].value >> 32), (DWORD)str2longlong[test_num].value);
+ else
- } /* for */
+ ok(result == str2longlong[test_num].value,
+ "(test %d): call failed: _atoi64(\"%s\") has result 0x%x%08x, expected: 0x%x%08x\n",
+ test_num, str2longlong[test_num].str, (DWORD)(result >> 32), (DWORD)result,
+ (DWORD)(str2longlong[test_num].value >> 32), (DWORD)str2longlong[test_num].value);
++}
}
for (test_num = 0; test_num < NB_STR2LONGLONG; test_num++) {
pRtlCreateUnicodeStringFromAsciiz(&uni, str2longlong[test_num].str);
result = p_wtoi64(uni.Buffer);
- ok(result == str2longlong[test_num].value,
+ if (str2longlong[test_num].overflow)
+ ok(result == str2longlong[test_num].value ||
+ (result == (str2longlong[test_num].overflow == -1) ?
+ ULL(0x80000000,0x00000000) : ULL(0x7fffffff,0xffffffff)),
+ "(test %d): call failed: _atoi64(\"%s\") has result 0x%x%08x, expected: 0x%x%08x\n",
+ test_num, str2longlong[test_num].str, (DWORD)(result >> 32), (DWORD)result,
+ (DWORD)(str2longlong[test_num].value >> 32), (DWORD)str2longlong[test_num].value);
+ else
- "(test %d): call failed: _wtoi64(\"%s\") has result 0x%x%08x, expected: 0x%x%08x\n",
+ ok(result == str2longlong[test_num].value,
- test_num, str2longlong[test_num].str, (DWORD)(result >> 32), (DWORD)result,
- (DWORD)(str2longlong[test_num].value >> 32), (DWORD)str2longlong[test_num].value);
+ "(test %d): call failed: _atoi64(\"%s\") has result 0x%x%08x, expected: 0x%x%08x\n",
+ test_num, str2longlong[test_num].str, (DWORD)(result >> 32), (DWORD)result,
+ (DWORD)(str2longlong[test_num].value >> 32), (DWORD)str2longlong[test_num].value);
pRtlFreeUnicodeString(&uni);
- } /* for */
- }
++}
}
static void test_wcsfuncs(void)
/* Length OK */
bool_ret = SQLInstallDriverManager(target_path, MAX_PATH, NULL);
sql_ret = SQLInstallerErrorW(1, &error_code, NULL, 0, NULL);
- ok(bool_ret, "SQLInstallDriverManager unexpectedly failed\n");
+ ok(bool_ret, "SQLInstallDriverManager unexpectedly failed: %d\n",
+ error_code);
+ if (bool_ret)
- ok(sql_ret == SQL_NO_DATA, "Expected SQL_NO_DATA, got %d\n", sql_ret);
+ ok(sql_ret == SQL_NO_DATA, "Expected SQL_NO_DATA, got %d\n", sql_ret);
+ else
+ ok(sql_ret == SQL_SUCCESS_WITH_INFO,
+ "Expected SQL_SUCCESS_WITH_INFO, got %d\n", sql_ret);
path_out = 0xcafe;
bool_ret = SQLInstallDriverManager(target_path, MAX_PATH, &path_out);
sql_ret = SQLInstallerErrorW(1, &error_code, NULL, 0, NULL);
- ok(bool_ret, "SQLInstallDriverManager unexpectedly failed\n");
+ ok(bool_ret, "SQLInstallDriverManager unexpectedly failed: %d\n",
+ error_code);
+ if (bool_ret)
- ok(sql_ret == SQL_NO_DATA, "Expected SQL_NO_DATA, got %d\n", sql_ret);
+ ok(sql_ret == SQL_NO_DATA, "Expected SQL_NO_DATA, got %d\n", sql_ret);
+ else
+ ok(sql_ret == SQL_SUCCESS_WITH_INFO,
+ "Expected SQL_SUCCESS_WITH_INFO, got %d\n", sql_ret);
/* path_out should in practice be less than 0xcafe */
ok(path_out != 0xcafe, "Expected path_out to show the correct amount of bytes\n");
}
if(!rgelt)
return E_INVALIDARG;
- count = min(celt, This->fmtetc_cnt - This->cur);
+ count = min(celt, This->fmtetc_cnt-This->cur);
- if(count > 0) {
- memcpy(rgelt, This->fmtetc+This->cur, count*sizeof(FORMATETC));
- This->cur += count;
+ for(i = 0; i < count; i++, This->cur++, rgelt++)
+ {
+ *rgelt = This->fmtetc[This->cur];
+ if(rgelt->ptd)
+ {
+ DWORD size = This->fmtetc[This->cur].ptd->tdSize;
+ rgelt->ptd = CoTaskMemAlloc(size);
+ memcpy(rgelt->ptd, This->fmtetc[This->cur].ptd, size);
- }
++ }
}
if(pceltFetched)
*pceltFetched = count;
DataObjectImpl_GetData_calls++;
if(pformatetc->lindex != -1)
- return DV_E_LINDEX;
-
- if(!(pformatetc->tymed & TYMED_HGLOBAL))
- return DV_E_TYMED;
-
- if(This->text && pformatetc->cfFormat == CF_TEXT)
- U(*pmedium).hGlobal = This->text;
- else
return DV_E_FORMATETC;
- pmedium->tymed = TYMED_HGLOBAL;
+ for(i = 0; i < This->fmtetc_cnt; i++)
+ {
+ if(This->fmtetc[i].cfFormat == pformatetc->cfFormat)
+ {
+ foundFormat = TRUE;
+ if(This->fmtetc[i].tymed & pformatetc->tymed)
+ {
- pmedium->pUnkForRelease = (LPUNKNOWN)iface;
- IUnknown_AddRef(pmedium->pUnkForRelease);
+ pmedium->pUnkForRelease = (LPUNKNOWN)iface;
+ IUnknown_AddRef(pmedium->pUnkForRelease);
+
+ if(pformatetc->cfFormat == CF_TEXT || pformatetc->cfFormat == cf_global)
+ {
+ pmedium->tymed = TYMED_HGLOBAL;
+ U(*pmedium).hGlobal = This->text;
+ }
+ else if(pformatetc->cfFormat == cf_stream)
+ {
+ pmedium->tymed = TYMED_ISTREAM;
+ IStream_AddRef(This->stm);
+ U(*pmedium).pstm = This->stm;
+ }
+ else if(pformatetc->cfFormat == cf_storage || pformatetc->cfFormat == cf_another)
+ {
+ pmedium->tymed = TYMED_ISTORAGE;
+ IStorage_AddRef(This->stg);
+ U(*pmedium).pstg = This->stg;
+ }
- return S_OK;
- }
+ return S_OK;
+}
+ }
+ }
+
+ return foundFormat ? DV_E_TYMED : DV_E_FORMATETC;
+ }
static HRESULT WINAPI DataObjectImpl_GetDataHere(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
{
marshal_data += sizeof(DWORD);
ok(*(void **)marshal_data == ptr, "expected %p, but got %p for mshctx\n", ptr, *(void **)marshal_data);
marshal_data += sizeof(void *);
- ok(*(DWORD *)marshal_data == 0, "expected 0x0, but got 0x%x\n", *(DWORD *)marshal_data);
- marshal_data += sizeof(DWORD);
+ if (sizeof(void*) == 4 && size >= 3*sizeof(DWORD))
+ {
- trace("got guid data: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
- ((GUID *)marshal_data)->Data1, ((GUID *)marshal_data)->Data2, ((GUID *)marshal_data)->Data3,
- ((GUID *)marshal_data)->Data4[0], ((GUID *)marshal_data)->Data4[1], ((GUID *)marshal_data)->Data4[2], ((GUID *)marshal_data)->Data4[3],
- ((GUID *)marshal_data)->Data4[4], ((GUID *)marshal_data)->Data4[5], ((GUID *)marshal_data)->Data4[6], ((GUID *)marshal_data)->Data4[7]);
- }
+ ok(*(DWORD *)marshal_data == 0, "expected 0x0, but got 0x%x\n", *(DWORD *)marshal_data);
+ marshal_data += sizeof(DWORD);
+ }
+ if (size >= 3*sizeof(DWORD) + sizeof(GUID))
+ {
+ trace("got guid data: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
+ ((GUID *)marshal_data)->Data1, ((GUID *)marshal_data)->Data2, ((GUID *)marshal_data)->Data3,
+ ((GUID *)marshal_data)->Data4[0], ((GUID *)marshal_data)->Data4[1], ((GUID *)marshal_data)->Data4[2], ((GUID *)marshal_data)->Data4[3],
+ ((GUID *)marshal_data)->Data4[4], ((GUID *)marshal_data)->Data4[5], ((GUID *)marshal_data)->Data4[6], ((GUID *)marshal_data)->Data4[7]);
+ }
+ }
else
{
ok(size > sizeof(DWORD), "size should have been > sizeof(DWORD), not %d\n", size);
WideCharToMultiByte(CP_ACP, 0, pszClsid, -1, buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), NULL, NULL);
CoTaskMemFree(pszClsid);
strcat(buffer, "\\InprocHandler32");
- error = RegCreateKeyEx(HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &dwDisposition);
- ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error);
- error = RegSetValueEx(hkey, NULL, 0, REG_SZ, (const unsigned char *)"ole32.dll", strlen("ole32.dll") + 1);
- ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error);
- RegCloseKey(hkey);
+ if (Register)
+ {
+ error = RegCreateKeyEx(HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &dwDisposition);
+ ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error);
+ error = RegSetValueEx(hkey, NULL, 0, REG_SZ, (const unsigned char *)"ole32.dll", strlen("ole32.dll") + 1);
+ ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error);
+ RegCloseKey(hkey);
+ }
+ else
+ {
+ RegDeleteKey(HKEY_CLASSES_ROOT, buffer);
+ *strrchr(buffer, '\\') = '\0';
+ RegDeleteKey(HKEY_CLASSES_ROOT, buffer);
+ }
+ }
+
+ static void test_inproc_handler(void)
+ {
+ HRESULT hr;
+ IUnknown *pObject;
+ IUnknown *pObject2;
+
+ reg_unreg_wine_test_class(TRUE);
hr = CoCreateInstance(&CLSID_WineTest, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pObject);
todo_wine
ok_ole_success(hr, "CoUnmarshalInterface");
IStream_Release(pStream);
- ok_more_than_one_lock();
+ if(hr == S_OK)
+ {
+ ok_more_than_one_lock();
- hr = IUnknown_QueryInterface(pProxy, &IID_IWineTest, (void **)&pObject);
- ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface with unknown IID should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+ hr = IUnknown_QueryInterface(pProxy, &IID_IWineTest, (void **)&pObject);
+ ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface with unknown IID should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
- /* it's a handler as it supports IOleObject */
- hr = IUnknown_QueryInterface(pProxy, &IID_IOleObject, (void **)&pObject);
- todo_wine
- ok_ole_success(hr, "IUnknown_QueryInterface(&IID_IOleObject)");
- if (SUCCEEDED(hr)) IUnknown_Release(pObject);
+ /* it's a handler as it supports IOleObject */
+ hr = IUnknown_QueryInterface(pProxy, &IID_IOleObject, (void **)&pObject);
+ todo_wine
+ ok_ole_success(hr, "IUnknown_QueryInterface(&IID_IOleObject)");
+ if (SUCCEEDED(hr)) IUnknown_Release(pObject);
- IUnknown_Release(pProxy);
+ IUnknown_Release(pProxy);
- ok_no_locks();
+ ok_no_locks();
+ }
end_host_object(tid, thread);
+ reg_unreg_wine_test_class(FALSE);
/* FIXME: test IPersist interface has the same effect as IStdMarshalInfo */
}
hr = IMoniker_BindToObject(pmk, pbc, NULL, &IID_IUnknown, (LPVOID*)&object);
ok_ole_success(hr, IMoniker_BindToObject);
- IUnknown_Release(object);
+ if (SUCCEEDED(hr))
+ IUnknown_Release(object);
IMoniker_Release(pmk);
}
IBindCtx_Release(pbc);
#define CHECK_EXPECTED_METHOD(method_name) \
do { \
trace("%s\n", method_name); \
- ok(*expected_method_list != NULL, "Extra method %s called\n", method_name); \
- if (*expected_method_list) \
+ ok(expected_method_list->method != NULL, "Extra method %s called\n", method_name); \
+ if (expected_method_list->method) \
{ \
- ok(!strcmp(*expected_method_list, method_name), "Expected %s to be called instead of %s\n", \
- *expected_method_list, method_name); \
+ while (expected_method_list->flags & TEST_OPTIONAL && \
+ strcmp(expected_method_list->method, method_name) != 0) \
- expected_method_list++; \
++ expected_method_list++; \
+ ok(!strcmp(expected_method_list->method, method_name), "Expected %s to be called instead of %s\n", \
+ expected_method_list->method, method_name); \
expected_method_list++; \
} \
} while(0)
expected_method_list = methods_oleload;
trace("OleLoad:\n");
hr = OleLoad(pStorage, &IID_IOleObject, (IOleClientSite *)0xdeadbeef, (void **)&pObject);
- ok_ole_success(hr, "OleLoad");
+ ok(hr == S_OK ||
+ broken(hr == E_INVALIDARG), /* win98 and win2k */
+ "OleLoad failed with error 0x%08x\n", hr);
if (pObject)
+ {
IOleObject_Release(pObject);
- ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
+ CHECK_NO_EXTRA_METHODS();
- }
++}
}
static BOOL STDMETHODCALLTYPE draw_continue(ULONG_PTR param)
"VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID"
};
- static void test_validtypes(void)
- {
- PROPVARIANT propvar;
- HRESULT hr;
- unsigned int i;
- BYTE version;
- memset(&propvar, 0, sizeof(propvar));
+ static void expect(HRESULT hr, VARTYPE vt)
+ {
+ int idx = vt & VT_TYPEMASK;
+ BYTE flags;
+ const char *modifier;
- /* detect version */
- propvar.vt = VT_I2 | VT_ARRAY;
- hr = PropVariantClear(&propvar);
- if (hr == S_OK)
+ if(vt & VT_BYREF)
{
- propvar.vt = VT_I8 | VT_ARRAY;
- hr = PropVariantClear(&propvar);
- if (hr == S_OK)
+ flags = valid_types[idx].byref;
+ modifier = "byref";
+ }
+ else if(vt & VT_ARRAY)
- {
+ {
- version = PROP_V1A;
- trace("detected prop variant v1a\n");
+ flags = valid_types[idx].with_array;
+ modifier = "array";
- }
+ }
+ else if(vt & VT_VECTOR)
+ {
+ flags = valid_types[idx].with_vector;
+ modifier = "vector";
+ }
- else
- {
+ else
+ {
- version = PROP_V1;
- trace("detected prop variant v1\n");
+ flags = valid_types[idx].simple;
+ modifier = "simple";
- }
+ }
+
+ if(flags == PROP_INV)
+ ok(hr == STG_E_INVALIDPARAMETER, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
+ else if(flags == PROP_V0)
+ ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
+ else if(flags & PROP_TODO)
+ {
+ todo_wine
+ {
+ if(hr != S_OK)
+ win_skip("%s (%s): unsupported\n", wine_vtypes[idx], modifier);
+ else ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
- }
++ }
}
else
{
/* Test various size operations and conversions. */
/* Add more as needed. */
- test_ifont_sizes(180000, 0, 72, 2540, -18, "default");
- test_ifont_sizes(180000, 0, 144, 2540, -36, "ratio1"); /* change ratio */
- test_ifont_sizes(180000, 0, 72, 1270, -36, "ratio2"); /* 2nd part of ratio */
+ if (0) /* FIXME: failing tests */
+ {
+ test_ifont_sizes(180000, 0, 72, 2540, -18, "default");
+ test_ifont_sizes(180000, 0, 144, 2540, -36, "ratio1"); /* change ratio */
+ test_ifont_sizes(180000, 0, 72, 1270, -36, "ratio2"); /* 2nd part of ratio */
- /* These depend on details of how IFont rounds sizes internally. */
- test_ifont_sizes(0, 0, 72, 2540, 0, "zero size"); /* zero size */
- test_ifont_sizes(186000, 0, 72, 2540, -19, "rounding"); /* test rounding */
+ /* These depend on details of how IFont rounds sizes internally. */
+ test_ifont_sizes(0, 0, 72, 2540, 0, "zero size"); /* zero size */
+ test_ifont_sizes(186000, 0, 72, 2540, -19, "rounding"); /* test rounding */
+ }
test_font_events_disp();
test_GetIDsOfNames();
{
hres = pSafeArrayGetVartype(a, &vt);
ok(hres == S_OK, "SAGVT of arra y with vt %d failed with %x\n", vttypes[i].vt, hres);
- if (vttypes[i].vt == VT_DISPATCH) {
- /* Special case. Checked against Windows. */
- ok(vt == VT_UNKNOWN, "SAGVT of a rray with VT_DISPATCH returned not VT_UNKNOWN, but %d\n", vt);
- } else {
- ok(vt == vttypes[i].vt, "SAGVT of array with vt %d returned %d\n", vttypes[i].vt, vt);
+ /* Windows prior to Vista returns VT_UNKNOWN instead of VT_DISPATCH */
+ ok(broken(vt == VT_UNKNOWN) || vt == vttypes[i].vt, "SAGVT of array with vt %d returned %d\n", vttypes[i].vt, vt);
- }
+ }
- }
hres = SafeArrayCopy(a, &c);
ok(hres == S_OK, "failed to copy safearray of vt %d with hres %x\n", vttypes[i].vt, hres);
if (pSafeArrayGetVartype) {
hres = pSafeArrayGetVartype(c, &vt);
ok(hres == S_OK, "SAGVT of array with vt %d failed with %x\n", vttypes[i].vt, hres);
- if (vttypes[i].vt == VT_DISPATCH) {
- /* Special case. Checked against Windows. */
- ok(vt == VT_UNKNOWN, "SAGVT of array with VT_DISPATCH returned not VT_UNKNOWN, but %d\n", vt);
- } else {
- ok(vt == vttypes[i].vt, "SAGVT of array with vt %d returned %d\n", vttypes[i].vt, vt);
+ /* Windows prior to Vista returns VT_UNKNOWN instead of VT_DISPATCH */
+ ok(broken(vt == VT_UNKNOWN) || vt == vttypes[i].vt, "SAGVT of array with vt %d returned %d\n", vttypes[i].vt, vt);
- }
+ }
- }
if (pSafeArrayCopyData) {
hres = pSafeArrayCopyData(a, c);
hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib);
ok_ole_success(hr, LoadRegTypeLib);
- if (SUCCEEDED(hr))
+ if (FAILED(hr))
+ return NULL;
+
+ hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, riid, &pTypeInfo);
+ ITypeLib_Release(pTypeLib);
+ ok_ole_success(hr, ITypeLib_GetTypeInfoOfGuid);
+ if (FAILED(hr))
+ return NULL;
+
+ return pTypeInfo;
+ }
+
+ static IWidget *Widget_Create(void)
-{
+ {
+ Widget *This;
- ITypeInfo *pTypeInfo;
+ ITypeInfo *pTypeInfo;
- hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IWidget, &pTypeInfo);
- ok_ole_success(hr, ITypeLib_GetTypeInfoOfGuid);
- if (SUCCEEDED(hr))
- {
+ HRESULT hr = E_FAIL;
+
+ pTypeInfo = get_type_info(&IID_IWidget);
+ if(!pTypeInfo)
+ return NULL;
+
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ This->lpVtbl = &Widget_VTable;
+ This->refs = 1;
- This->pDispatchUnknown = NULL;
+ This->pDispatchUnknown = NULL;
+
- hr = CreateStdDispatch((IUnknown *)&This->lpVtbl, This, pTypeInfo, &This->pDispatchUnknown);
- ok_ole_success(hr, CreateStdDispatch);
- ITypeInfo_Release(pTypeInfo);
+ hr = CreateStdDispatch((IUnknown *)&This->lpVtbl, This, pTypeInfo, &This->pDispatchUnknown);
+ ok_ole_success(hr, CreateStdDispatch);
+ ITypeInfo_Release(pTypeInfo);
- }
- }
if (SUCCEEDED(hr))
return (IWidget *)&This->lpVtbl;
hr = ITypeInfo_GetTypeAttr(pTI, &pTA);
ok(hr == S_OK, "hr %08x\n", hr);
- ok(pTA->typekind == TKIND_DISPATCH, "kind %04x\n", pTA->typekind);
+ if (hr == S_OK)
+ {
- ok(pTA->cbSizeVft == 28, "sizevft %d\n", pTA->cbSizeVft);
+ ok(pTA->typekind == TKIND_DISPATCH, "kind %04x\n", pTA->typekind);
- if(use_midl_tlb) {
- ok(pTA->wTypeFlags == TYPEFLAG_FDUAL, "typeflags %x\n", pTA->wTypeFlags);
- }
- ok(pTA->cFuncs == 8, "cfuncs %d\n", pTA->cFuncs);
- ok(pTA->cImplTypes == 1, "cimpltypes %d\n", pTA->cImplTypes);
- ITypeInfo_ReleaseTypeAttr(pTI, pTA);
+ ok(pTA->cbSizeVft == 7 * sizeof(void *), "sizevft %d\n", pTA->cbSizeVft);
-
+if(use_midl_tlb) {
+ ok(pTA->wTypeFlags == TYPEFLAG_FDUAL, "typeflags %x\n", pTA->wTypeFlags);
+ }
+ ok(pTA->cFuncs == 8, "cfuncs %d\n", pTA->cFuncs);
+ ok(pTA->cImplTypes == 1, "cimpltypes %d\n", pTA->cImplTypes);
+ ITypeInfo_ReleaseTypeAttr(pTI, pTA);
+ }
hr = ITypeInfo_GetRefTypeOfImplType(pTI, 0, &href);
ok(hr == S_OK, "hr %08x\n", hr);
hr = ITypeInfo_GetRefTypeInfo(pTI, href, &pTI_p);
test_TypeInfo();
test_QueryPathOfRegTypeLib();
test_inheritance();
- test_dump_typelib("test_tlb.tlb");
+
+ if ((filename = create_test_typelib()))
+ {
+ test_dump_typelib( filename );
+ DeleteFile( filename );
- }
++}
+
+ test_create_typelibs();
+
}
V_ARRAYREF(&v) = &lpsa;
rpcMsg.BufferLength = stubMsg.BufferLength = VARIANT_UserSize(&umcb.Flags, 0, &v);
- ok(stubMsg.BufferLength == 152, "size %d\n", stubMsg.BufferLength);
- buffer = rpcMsg.Buffer = stubMsg.Buffer = stubMsg.BufferStart = HeapAlloc(GetProcessHeap(), 0, stubMsg.BufferLength);
+ expected = 152;
+ ok(stubMsg.BufferLength == expected || stubMsg.BufferLength == expected + 16, /* win64 */
+ "size %u instead of %u\n", stubMsg.BufferLength, expected);
+ buffer = rpcMsg.Buffer = stubMsg.Buffer = stubMsg.BufferStart = alloc_aligned(stubMsg.BufferLength, &oldbuffer);
stubMsg.BufferEnd = stubMsg.Buffer + stubMsg.BufferLength;
next = VARIANT_UserMarshal(&umcb.Flags, buffer, &v);
- ok(next == buffer + stubMsg.BufferLength, "got %p expect %p\n", next, buffer + stubMsg.BufferLength);
+ ok(next == buffer + expected, "got %p expect %p\n", next, buffer + expected);
wirev = (DWORD*)buffer;
-
+
- check_variant_header(wirev, &v, stubMsg.BufferLength);
+ check_variant_header(wirev, &v, expected);
wirev += 5;
ok(*wirev == 4, "wv[5] %08x\n", *wirev);
wirev++;
static void init(void)
{
- hOleaut32 = GetModuleHandle("oleaut32.dll");
+ BSTR bstr;
+ HRESULT res;
+
+ res = VarBstrFromBool(VARIANT_TRUE, LANG_USER_DEFAULT, VAR_LOCALBOOL, &bstr);
+ ok(SUCCEEDED(res) && (lstrlenW(bstr) > 0),
+ "Expected localized string for 'True'\n");
+ /* lstrcpyW / lstrcatW do not work on win95 */
+ memcpy(sz12_true, sz12, sizeof(sz12));
+ if (bstr) memcpy(&sz12_true[2], bstr, SysStringByteLen(bstr) + sizeof(WCHAR));
+ SysFreeString(bstr);
+
+ res = VarBstrFromBool(VARIANT_FALSE, LANG_USER_DEFAULT, VAR_LOCALBOOL, &bstr);
+ ok(SUCCEEDED(res) && (lstrlenW(bstr) > 0),
+ "Expected localized string for 'False'\n");
+ memcpy(sz12_false, sz12, sizeof(sz12));
+ if (bstr) memcpy(&sz12_false[2], bstr, SysStringByteLen(bstr) + sizeof(WCHAR));
+ SysFreeString(bstr);
+
+ hOleaut32 = GetModuleHandle("oleaut32.dll");
/* Is a given function exported from oleaut32? */
#define HAVE_FUNC(func) ((void*)GetProcAddress(hOleaut32, #func) != NULL)
ok(V_VT(&vDst) == (vt|ExtraFlags[i]),
"Copy(bad src): expected vt = %d, got %d\n",
vt | ExtraFlags[i], V_VT(&vDst));
- }
+ VariantClear(&vDst);
}
}
++ }
/* Test that copying a NULL BSTR results in an empty BSTR */
memset(&vDst, 0, sizeof(vDst));
leftvt == VT_RECORD || rightvt == VT_RECORD)
{
if (leftvt == VT_RECORD && rightvt == VT_I8)
- expectedhres = DISP_E_TYPEMISMATCH;
+ {
+ if (HAVE_OLEAUT32_I8)
+ expectedhres = DISP_E_TYPEMISMATCH;
+ else
+ expectedhres = DISP_E_BADVARTYPE;
+ }
else if (leftvt < VT_UI1 && rightvt == VT_RECORD)
expectedhres = DISP_E_TYPEMISMATCH;
else if (leftvt >= VT_UI1 && rightvt == VT_RECORD)
"VARPOW: CY value %f, expected %f\n", V_R8(&result), 4.0);
hres = pVarPow(&cy, &right, &result);
- ok(hres == S_OK && V_VT(&result) == VT_R8,
- "VARPOW: expected coerced hres 0x%X type VT_R8, got hres 0x%X type %s!\n",
- S_OK, hres, vtstr(V_VT(&result)));
- ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 4.0),
- "VARPOW: CY value %f, expected %f\n", V_R8(&result), 4.0);
+ if (hres == S_OK)
+ {
+ ok(hres == S_OK && V_VT(&result) == VT_R8,
+ "VARPOW: expected coerced hres 0x%X type VT_R8, got hres 0x%X type %s!\n",
+ S_OK, hres, vtstr(V_VT(&result)));
+ ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 4.0),
+ "VARPOW: CY value %f, expected %f\n", V_R8(&result), 4.0);
+ }
+ else
+ {
+ ok(hres == DISP_E_BADVARTYPE && V_VT(&result) == VT_EMPTY,
+ "VARPOW: expected coerced hres 0x%X type VT_EMPTY, got hres 0x%X type %s!\n",
+ DISP_E_BADVARTYPE, hres, vtstr(V_VT(&result)));
+ }
hres = pVarPow(&left, &cy, &result);
ok(hres == S_OK && V_VT(&result) == VT_R8,
"VARPOW: DECIMAL value %f, expected %f\n", V_R8(&result), 4.0);
hres = pVarPow(&dec, &right, &result);
- ok(hres == S_OK && V_VT(&result) == VT_R8,
- "VARPOW: expected coerced hres 0x%X type VT_R8, got hres 0x%X type %s!\n",
- S_OK, hres, vtstr(V_VT(&result)));
- ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 4.0),
- "VARPOW: DECIMAL value %f, expected %f\n", V_R8(&result), 4.0);
+ if (hres == S_OK)
+ {
+ ok(hres == S_OK && V_VT(&result) == VT_R8,
+ "VARPOW: expected coerced hres 0x%X type VT_R8, got hres 0x%X type %s!\n",
+ S_OK, hres, vtstr(V_VT(&result)));
+ ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 4.0),
+ "VARPOW: DECIMAL value %f, expected %f\n", V_R8(&result), 4.0);
+ }
+ else
+ {
+ ok(hres == DISP_E_BADVARTYPE && V_VT(&result) == VT_EMPTY,
+ "VARPOW: expected coerced hres 0x%X type VT_EMPTY, got hres 0x%X type %s!\n",
+ DISP_E_BADVARTYPE, hres, vtstr(V_VT(&result)));
+ }
SysFreeString(num2_str);
SysFreeString(num3_str);
<module name="powrprof_winetest" type="win32cui" installbase="bin" installname="powrprof_winetest.exe" allowwarnings="true">
<include base="powrprof_winetest">.</include>
- <define name="__USE_W32API" />
+ <define name="__ROS_LONG64__" />
- <define name="UNICODE" />
- <define name="_UNICODE" />
+ <define name="UNICODE" />
+ <define name="_UNICODE" />
<library>powrprof</library>
<library>ntdll</library>
<library>advapi32</library>
}
- void test_WriteGlobalPwrPolicy(void)
+ void test_ValidatePowerPolicies(void)
{
- // WriteGlobalPwrPolicy(&gpp);
- }
+ GLOBAL_POWER_POLICY gpp, gpp_compare, gpp_original;
+ POWER_POLICY pp, pp_compare, pp_original;
+ BOOLEAN ret;
- void test_WriteProcessorPwrScheme(void)
- {
- // WriteProcessorPwrScheme(0,&mppp);
- }
+ RtlZeroMemory(&gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ RtlZeroMemory(&pp_original, sizeof(POWER_POLICY));
- void test_WritePwrScheme(void)
- {
- DWORD retval;
- static const WCHAR szTestSchemeName[] = {'P','o','w','r','p','r','o','f',0};
- static const WCHAR szTestSchemeDesc[] = {'P','o','w','r','p','r','o','f',' ','S','c','h','e','m','e',0};
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ok(compare(pp,pp_compare),"Difference Found\n");
- /*
- * create a temporarly profile, will be deleted in test_DeletePwrScheme
- */
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- retval = WritePwrScheme(&g_TempPwrScheme, (LPWSTR)szTestSchemeName, (LPWSTR)szTestSchemeDesc, &g_PowerPolicy);
- ok(retval, "Warning: function should have succeeded\n");
- }
+ SetLastError(0);
+ ret = ValidatePowerPolicies(0,0);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
- void func_power(void)
- {
- test_CallNtPowerInformation();
- test_CanUserWritePwrScheme();
- test_EnumPwrSchemes();
- test_GetSetActivePwrScheme();
- test_ReadPwrScheme();
- test_WritePwrScheme();
- test_DeletePwrScheme();
- test_GetPwrDiskSpindownRange();
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH(%i,%i), but error :%i\n",(UINT)gpp.user.Revision,(UINT)gpp.mach.Revision,(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- test_GetCurrentPowerPolicies();
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- test_GetPwrCapabilities();
- test_IsAdminOverrideActive();
- test_IsPwrHibernateAllowed();
- test_IsPwrShutdownAllowed();
- test_IsPwrSuspendAllowed();
- test_ReadGlobalPwrPolicy();
- test_ReadProcessorPwrScheme();
- test_SetSuspendState();
- test_ValidatePowerPolicies();
- test_WriteGlobalPwrPolicy();
- test_WriteProcessorPwrScheme();
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
- }
+ gpp_original.user.Revision = 1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- void func_ros_init(void)
- {
- HKEY hUser, hKeyPowrCfg, hKeyGlobalPowrPol, hKeyPowerPolicies, hKeytmp;
- DWORD err;
- GLOBAL_USER_POWER_POLICY gupp;
- GLOBAL_MACHINE_POWER_POLICY gmpp;
- USER_POWER_POLICY upp;
- MACHINE_POWER_POLICY mpp;
- MACHINE_PROCESSOR_POWER_POLICY mppp;
- GLOBAL_POWER_POLICY gpp;
- POWER_POLICY pp;
+ gpp_original.mach.Revision = 1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.mach.LidOpenWakeAc = PowerSystemWorking;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.mach.LidOpenWakeDc = PowerSystemWorking;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.PowerButtonAc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.PowerButtonDc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.SleepButtonAc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.SleepButtonDc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.LidCloseAc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.LidCloseDc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[0].Enable=FALSE;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[1].Enable=FALSE;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[2].Enable=FALSE;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[3].Enable=FALSE;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[4].Enable=FALSE;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ pp_original.user.Revision = 1;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- int i;
+ pp_original.mach.Revision = 1;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szUserPowrCfgKey[] = { 'C', 'o', 'n', 't', 'r', 'o', 'l', ' ',
- 'P', 'a', 'n', 'e', 'l', '\\', 'P', 'o', 'w', 'e', 'r', 'C', 'f', 'g', 0};
+ pp_original.mach.MinSleepAc = PowerSystemWorking;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szCurrentPowerPolicy[] = {'C', 'u', 'r', 'r', 'e', 'n', 't', 'P',
- 'o', 'w', 'e', 'r', 'P', 'o', 'l', 'i', 'c', 'y', 0};
- static const WCHAR szcpp[] = {'3', 0 };
+ pp_original.mach.MinSleepDc = PowerSystemWorking;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szGlobalPowerPolicy[] = { 'G', 'l', 'o', 'b', 'a', 'l', 'P', 'o',
- 'w', 'e', 'r', 'P', 'o', 'l', 'i', 'c', 'y', 0};
- static const WCHAR szPolicies[] = {'P', 'o', 'l', 'i', 'c', 'i', 'e', 's', 0};
- static const WCHAR szPowerPolicies[] = { 'P', 'o', 'w', 'e', 'r', 'P', 'o', 'l', 'i',
- 'c', 'i', 'e', 's', 0};
+ pp_original.mach.ReducedLatencySleepAc = PowerSystemWorking;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szProcessorPolicies[] = { 'P', 'r', 'o', 'c', 'e', 's', 's', 'o', 'r',
- 'P', 'o', 'l', 'i', 'c', 'i', 'e', 's', 0};
+ pp_original.mach.ReducedLatencySleepDc = PowerSystemWorking;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szcName[] = {'N', 'a', 'm', 'e', 0};
- static const WCHAR szcDescription[] = {'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', 0};
+ pp_original.mach.OverThrottledAc.Action = PowerActionNone;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static WCHAR szName[] = {'N', 'a', 'm', 'e', '(', '0', ')', 0};
- static WCHAR szDescription[] = {'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', '(', '0', ')', 0};
+ pp_original.mach.OverThrottledDc.Action = PowerActionNone;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szMachPowrCfgKey[] = {'S', 'O', 'F', 'T', 'W', 'A', 'R', 'E', '\\', 'M', 'i',
- 'c', 'r', 'o', 's', 'o', 'f', 't', '\\', 'W', 'i', 'n', 'd', 'o', 'w', 's', '\\', 'C', 'u',
- 'r', 'r', 'e', 'n', 't', 'V', 'e', 'r', 's', 'i', 'o', 'n', '\\', 'C', 'o', 'n', 't', 'r',
- 'o', 'l', 's', ' ', 'F', 'o', 'l', 'd', 'e', 'r', '\\', 'P', 'o', 'w', 'e', 'r', 'C', 'f', 'g', 0};
+ pp_original.user.IdleAc.Action = PowerActionWarmEject+1;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szLastID[] = {'L', 'a', 's', 't', 'I', 'D', 0};
- static const WCHAR szDiskSpinDownMax[] = {'D', 'i', 's', 'k', 'S', 'p', 'i', 'n', 'D', 'o', 'w', 'n', 'M', 'a', 'x', 0};
- static const WCHAR szDiskSpinDownMin[] = {'D', 'i', 's', 'k', 'S', 'p', 'i', 'n', 'D', 'o', 'w', 'n', 'M', 'i', 'n', 0};
+ pp_original.user.IdleDc.Action = PowerActionNone-1;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- static const WCHAR szLastIDValue[] = {'5', 0};
- static const WCHAR szDiskSpinDownMaxValue[] = {'3', '6', '0', '0', 0};
- static const WCHAR szDiskSpinDownMinValue[] = {'3', 0};
+ pp_original.user.MaxSleepAc = PowerSystemMaximum+1;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- WCHAR tmp[20];
- /*
- * Erstelle die Registry-struktur und Daten, welche dafür erforderlich ist damit diese Tests funktionieren
- */
+ pp_original.user.MaxSleepDc = PowerSystemUnspecified;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- /*
- * User
- */
- err = RegOpenCurrentUser(KEY_ALL_ACCESS,&hUser);
- ok(err == ERROR_SUCCESS,"Öffnen des Aktuellen Users Fehlgeschlagen\n");
- if (err == ERROR_SUCCESS)
- {
- err = RegCreateKey(hUser,szUserPowrCfgKey,&hKeyPowrCfg);
- ok(err == ERROR_SUCCESS,"Create Key UserPowrCfg failed with error %i\n",(UINT)err);
- ok(hKeyPowrCfg != NULL,"Erstellen des Eintrages Powercfg fehlgeschalgen\n");
- err = RegSetValueExW(hKeyPowrCfg,szCurrentPowerPolicy,(DWORD)NULL,REG_SZ,(CONST BYTE *)szcpp,strlenW(szcpp)*sizeof(WCHAR));
- ok(err == ERROR_SUCCESS,"Set Value CurrentPowerPolicy failed with error %i\n",(UINT)err);
- err = RegCreateKey(hKeyPowrCfg,szGlobalPowerPolicy,&hKeyGlobalPowrPol);
- ok(err == ERROR_SUCCESS,"Create Key GlobalPowerPolicy failed with error %i\n",(UINT)err);
- gupp.Revision = 1;
- gupp.PowerButtonAc.Action = PowerActionNone;
- gupp.PowerButtonDc.Action = PowerActionNone;
- gupp.SleepButtonAc.Action = PowerActionNone;
- gupp.SleepButtonDc.Action = PowerActionNone;
- gupp.LidCloseAc.Action = PowerActionNone;
- gupp.LidCloseDc.Action = PowerActionNone;
- for (i=0; i<NUM_DISCHARGE_POLICIES; i++)
- {
- gupp.DischargePolicy[0].Enable=FALSE;
- }
+ pp_original.user.IdleAc.Action = PowerActionNone;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- err = RegSetValueExW(hKeyGlobalPowrPol,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&gupp,sizeof(GLOBAL_USER_POWER_POLICY));
- ok(err == ERROR_SUCCESS,"Set Value GlobalPowrPol failed with error %i\n",(UINT)err);
- err = RegCloseKey(hKeyGlobalPowrPol);
- ok(err == ERROR_SUCCESS,"Close Key GlobalPowrPol failed with error %i\n",(UINT)err);
- err = RegCreateKey(hKeyPowrCfg,szPowerPolicies,&hKeyPowerPolicies);
- ok(err == ERROR_SUCCESS,"Create Key PowerPolicies failed with error %i\n",(UINT)err);
-
- upp.Revision = 1;
- upp.IdleAc.Action = PowerActionNone;
- upp.IdleDc.Action = PowerActionNone;
- upp.MaxSleepAc = PowerSystemWorking;
- upp.MaxSleepDc = PowerSystemWorking;
- upp.VideoTimeoutAc = 0;
- upp.VideoTimeoutDc = 0;
- upp.SpindownTimeoutAc = 0;
- upp.SpindownTimeoutDc = 0;
-
- for (i = 0; i<6; i++)
- {
- _itow(i,tmp,10);
- err = RegCreateKey(hKeyPowerPolicies,tmp,&hKeytmp);
- ok(err == ERROR_SUCCESS,"Create Key PowerPolicies(%i) failed with error %i\n",i,(UINT)err);
- szName[5]++;
- szDescription[12]++;
- err = RegSetValueExW(hKeytmp,szcName,(DWORD)NULL,REG_SZ,(CONST BYTE *)szName,strlenW(szName)*sizeof(WCHAR));
- err = RegSetValueExW(hKeytmp,szcDescription,(DWORD)NULL,REG_SZ,(CONST BYTE *)szDescription,strlenW(szDescription)*sizeof(WCHAR));
- err = RegSetValueExW(hKeytmp,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&upp,sizeof(USER_POWER_POLICY));
- err = RegCloseKey(hKeytmp);
- }
- err = RegCloseKey(hKeyPowerPolicies);
- err = RegCloseKey(hKeyPowrCfg);
- err = RegCloseKey(hUser);
- }
+ pp_original.user.IdleDc.Action = PowerActionNone;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- /*
- * Mach
- */
- err = RegCreateKey(HKEY_LOCAL_MACHINE,szMachPowrCfgKey,&hKeyPowrCfg);
- ok(err == ERROR_SUCCESS,"Create Key MachPowrCfgKey failed with error %i\n",(UINT)err);
- err = RegSetValueExW(hKeyPowrCfg,szLastID,(DWORD)NULL,REG_SZ,(CONST BYTE *)szLastIDValue,strlenW(szLastIDValue)*sizeof(WCHAR));
- err = RegSetValueExW(hKeyPowrCfg,szDiskSpinDownMax,(DWORD)NULL,REG_SZ,(CONST BYTE *)szDiskSpinDownMaxValue,strlenW(szDiskSpinDownMaxValue)*sizeof(WCHAR));
- err = RegSetValueExW(hKeyPowrCfg,szDiskSpinDownMin,(DWORD)NULL,REG_SZ,(CONST BYTE *)szDiskSpinDownMinValue,strlenW(szDiskSpinDownMinValue)*sizeof(WCHAR));
-
- err = RegCreateKey(hKeyPowrCfg,szGlobalPowerPolicy,&hKeyGlobalPowrPol);
- ok(err == ERROR_SUCCESS,"Create Key Mach GlobalPowerPolicy failed with error %i\n",(UINT)err);
- gmpp.Revision = 1;
- gmpp.LidOpenWakeAc = PowerSystemWorking;
- gmpp.LidOpenWakeDc = PowerSystemWorking;
- gmpp.BroadcastCapacityResolution=0;
-
- err = RegSetValueExW(hKeyGlobalPowrPol,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&gmpp,sizeof(GLOBAL_MACHINE_POWER_POLICY));
-
- err = RegCloseKey(hKeyGlobalPowrPol);
- err = RegCreateKey(hKeyPowrCfg,szPowerPolicies,&hKeyPowerPolicies);
- ok(err == ERROR_SUCCESS,"Create Key Mach PowerPolicies failed with error %i\n",(UINT)err);
-
- mpp.Revision = 1;
- mpp.MinSleepAc = PowerSystemWorking;
- mpp.MinSleepDc = PowerSystemWorking;
- mpp.ReducedLatencySleepAc = PowerSystemWorking;
- mpp.ReducedLatencySleepDc = PowerSystemWorking;
- mpp.OverThrottledAc.Action = PowerActionNone;
- mpp.OverThrottledDc.Action = PowerActionNone;
- mpp.DozeS4TimeoutAc=0;
- mpp.DozeS4TimeoutDc=0;
-
- for (i = 0; i<6; i++)
- {
- _itow(i,tmp,10);
- err = RegCreateKey(hKeyPowerPolicies,tmp,&hKeytmp);
- ok(err == ERROR_SUCCESS,"Create Key Mach PowerPolicies(%i) failed with error %i\n",(UINT)i,(UINT)err);
- err = RegSetValueExW(hKeytmp,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&mpp,sizeof(MACHINE_POWER_POLICY));
- err = RegCloseKey(hKeytmp);
- }
- err = RegCloseKey(hKeyPowerPolicies);
+ pp_original.user.MaxSleepAc = PowerSystemWorking;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
- err = RegCreateKey(hKeyPowrCfg,szProcessorPolicies,&hKeyPowerPolicies);
- ok(err == ERROR_SUCCESS,"Create Key Mach ProcessorPolicies failed with error %i\n",(UINT)err);
+ pp_original.user.MaxSleepDc = PowerSystemWorking;
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.BroadcastCapacityResolution=100;
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+
+ gpp_original.mach.BroadcastCapacityResolution=95;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[1].PowerPolicy.EventCode = 256;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[2].PowerPolicy.EventCode = 256;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.user.DischargePolicy[3].PowerPolicy.EventCode = 256;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+ gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
+ gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196864;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+
+ gpp_original.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+ gpp_original.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
+ gpp_original.user.DischargePolicy[3].PowerPolicy.EventCode = 196864;
+ gpp_original.mach.LidOpenWakeAc=PowerSystemUnspecified;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.mach.LidOpenWakeAc=PowerSystemWorking;
+ gpp_original.mach.LidOpenWakeDc=PowerSystemUnspecified;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ gpp_original.mach.LidOpenWakeDc=PowerSystemWorking;
+ gpp_original.user.LidCloseAc.Action = PowerActionWarmEject+1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- mppp.Revision = 1;
- mppp.ProcessorPolicyAc.Revision = 1;
- mppp.ProcessorPolicyDc.Revision = 1;
+ gpp_original.user.LidCloseAc.Action = PowerActionWarmEject;
+ gpp_original.user.LidCloseDc.Action = PowerActionNone;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- for (i = 0; i<6; i++)
- {
- _itow(i,tmp,10);
- err = RegCreateKey(hKeyPowerPolicies,tmp,&hKeytmp);
- ok(err == ERROR_SUCCESS,"Create Key Mach ProcessorPolicies(%i) failed with error %i\n",i,(UINT)err);
- err = RegSetValueExW(hKeytmp,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&mppp,sizeof(MACHINE_PROCESSOR_POWER_POLICY));
- err = RegCloseKey(hKeytmp);
- }
- err = RegCloseKey(hKeyPowerPolicies);
+ gpp_original.user.LidCloseDc.Action = PowerActionWarmEject;
+ gpp_original.user.PowerButtonAc.Action = PowerActionNone-1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- err = RegCloseKey(hKeyPowrCfg);
+ gpp_original.user.PowerButtonAc.Action = PowerActionNone;
+ gpp_original.user.PowerButtonDc.Action = PowerActionWarmEject;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- err = GetCurrentPowerPolicies(&gpp,&pp);
- ok(err, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_original.user.SleepButtonAc.Action = PowerActionWarmEject;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- err = ValidatePowerPolicies(&gpp,&pp);
- ok(err, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_original.user.SleepButtonDc.Action = PowerActionWarmEject;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
- /*
- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy]
- "CursorProperties"=...
- */
+ pp_original.mach.MinSleepAc=PowerSystemUnspecified-1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemUnspecified-1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemUnspecified-1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemUnspecified-1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemUnspecified;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemUnspecified;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemUnspecified;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemUnspecified;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemWorking;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ //pp_compare.mach.MinSleepAc=4;
+ //pp_compare.mach.MinSleepDc=4;
+ //pp_compare.user.MaxSleepAc=4;
+ //pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemWorking;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ //pp_compare.mach.MinSleepAc=4;
+ //pp_compare.mach.MinSleepDc=4;
+ //pp_compare.user.MaxSleepAc=4;
+ //pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemWorking;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ //pp_compare.mach.MinSleepAc=4;
+ //pp_compare.mach.MinSleepDc=4;
+ //pp_compare.user.MaxSleepAc=4;
+ //pp_compare.user.MaxSleepDc=4;
+ //pp_compare.user.OptimizeForPowerAc=1;
+ //pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemWorking;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemSleeping1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemSleeping1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemSleeping1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemSleeping1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemSleeping2;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemSleeping2;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemSleeping2;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemSleeping2;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemSleeping3;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemSleeping3;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemSleeping3;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemSleeping3;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemHibernate;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemHibernate;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemHibernate;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemHibernate;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ pp_compare.user.OptimizeForPowerAc=1;
+ pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemShutdown;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemShutdown;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemShutdown;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemShutdown;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemMaximum;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemMaximum;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemMaximum;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemMaximum;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemMaximum+1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepDc=PowerSystemMaximum+1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepAc=PowerSystemMaximum+1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.user.MaxSleepDc=PowerSystemMaximum+1;
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pp_original.mach.MinSleepAc=PowerSystemWorking;
+ pp_original.mach.MinSleepDc=PowerSystemWorking;
+ pp_original.user.MaxSleepAc=PowerSystemWorking;
+ pp_original.user.MaxSleepDc=PowerSystemWorking;
+
+
+ test_ValidatePowerPolicies_Next(&gpp_original,&pp_original);
+
+
+ // memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ // memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ //memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ // memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = GetCurrentPowerPolicies(&gpp_original,&pp_original);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ //gpp_compare.mach.BroadcastCapacityResolution = 3;
+ //gpp_compare.user.PowerButtonAc.Action = 2;
+ //gpp_compare.user.PowerButtonAc.Flags=3;
+ //gpp_compare.user.PowerButtonDc.EventCode=16;
+ //gpp_compare.user.PowerButtonDc.Flags=3;
+ //gpp_compare.user.SleepButtonAc.Action=2;
+ //gpp_compare.user.SleepButtonAc.Flags=3;
+ //gpp_compare.user.SleepButtonDc.Action=2;
+ //gpp_compare.user.SleepButtonDc.Flags=3;
+ //gpp_compare.user.LidCloseAc.EventCode=-2147483648;
+ //gpp_compare.user.LidCloseAc.Flags=1;
+ //gpp_compare.user.LidCloseDc.EventCode=-2147483648;
+ //gpp_compare.user.LidCloseDc.Flags=1;
+
+ //gpp_compare.user.DischargePolicy[0].Enable=1;
+ ////gpp_compare.user.DischargePolicy[0].Spare[0]=3;
+ //gpp_compare.user.DischargePolicy[0].Spare[3]=3;
+ //gpp_compare.user.DischargePolicy[0].BatteryLevel=3;
+ //gpp_compare.user.DischargePolicy[0].PowerPolicy.Action=2;
+ //gpp_compare.user.DischargePolicy[0].PowerPolicy.Flags=-1073741820;
+ //gpp_compare.user.DischargePolicy[0].PowerPolicy.EventCode=1;
+ //gpp_compare.user.DischargePolicy[0].MinSystemState=4;
+
+ //gpp_compare.user.DischargePolicy[1].Enable=1;
+ ////gpp_compare.user.DischargePolicy[1].Spare[0]=3;
+ //gpp_compare.user.DischargePolicy[1].Spare[3]=10;
+ //gpp_compare.user.DischargePolicy[1].BatteryLevel=10;
+ ////gpp_compare.user.DischargePolicy[1].PowerPolicy.Action=3;
+ //gpp_compare.user.DischargePolicy[1].PowerPolicy.Flags=3;
+ //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode=65537;
+ //gpp_compare.user.DischargePolicy[1].MinSystemState=1;
+ //
+ //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode=131072;
+ //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode=196608;
+ //gpp_compare.user.GlobalFlags=20;
+
+ //ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.MinSleepAc=4;
+ //pp_compare.mach.MinSleepDc=4;
+ //pp_compare.mach.ReducedLatencySleepAc=4;
+ //pp_compare.mach.ReducedLatencySleepDc=4;
+ //pp_compare.mach.OverThrottledAc.Action=2;
+ //pp_compare.mach.OverThrottledAc.Flags=-1073741820;
+ //pp_compare.mach.OverThrottledDc.Action=2;
+ //pp_compare.mach.OverThrottledDc.Flags=-1073741820;
+ //pp_compare.mach.pad1[2]=2;
+ //pp_compare.user.IdleAc.Flags=1;
+ //pp_compare.user.IdleDc.Flags=1;
+ //pp_compare.user.IdleSensitivityAc=50;
+ //pp_compare.user.IdleSensitivityDc=50;
+ //pp_compare.user.ThrottlePolicyAc=3;
+ //pp_compare.user.ThrottlePolicyDc=3;
+ //pp_compare.user.Reserved[2]=1200;
+ //pp_compare.user.VideoTimeoutAc=1200;
+ //pp_compare.user.VideoTimeoutDc=600;
+ //pp_compare.user.SpindownTimeoutAc=2700;
+ //pp_compare.user.SpindownTimeoutDc=600;
+ //pp_compare.user.FanThrottleToleranceAc=100;
+ //pp_compare.user.FanThrottleToleranceDc=80;
+ //pp_compare.user.ForcedThrottleAc=100;
+ //pp_compare.user.ForcedThrottleDc=100;
+ //pp_compare.user.MaxSleepAc=4;
+ //pp_compare.user.MaxSleepDc=4;
+ //pp_compare.user.OptimizeForPowerAc=1;
+ //pp_compare.user.OptimizeForPowerDc=1;
+ //ok(compare(pp,pp_compare),"Difference Found\n");
+
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,0);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ //gpp_compare.mach.BroadcastCapacityResolution=100;
+ //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(0,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ //pp_compare.mach.MinSleepAc=4;
+ //pp_compare.mach.MinSleepDc=4;
+ //pp_compare.user.MaxSleepAc=4;
+ //pp_compare.user.MaxSleepDc=4;
+ //pp_compare.user.OptimizeForPowerAc=1;
+ //pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ //gpp_compare.mach.BroadcastCapacityResolution=100;
+ //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+ //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+ //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ pp_compare.mach.MinSleepDc=4;
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepDc=4;
+ //pp_compare.user.OptimizeForPowerAc=1;
+ //pp_compare.user.OptimizeForPowerDc=1;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ }
+
+ void test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original,PPOWER_POLICY pPP_original)
+ {
+ GLOBAL_POWER_POLICY gpp, gpp_compare;
+ POWER_POLICY pp, pp_compare;
+ BOOLEAN ret;
+
+ //printf("Old: %i\n",pGPP_original->mach.LidOpenWakeAc);//1
+ //printf("Old: %i\n",pGPP_original->mach.LidOpenWakeDc);//1
+ //printf("Old: %i,%i,%i \n",pGPP_original->user.LidCloseAc.Action,pGPP_original->user.LidCloseAc.EventCode,pGPP_original->user.LidCloseAc.Flags);//7
+ //printf("Old: %i,%i,%i \n",pGPP_original->user.LidCloseDc.Action,pGPP_original->user.LidCloseDc.EventCode,pGPP_original->user.LidCloseDc.Flags);//7
+ //printf("Old: %i,%i,%i \n",pGPP_original->user.PowerButtonAc.Action,pGPP_original->user.PowerButtonAc.EventCode,pGPP_original->user.PowerButtonAc.Flags);//0,0,0
+ //printf("Old: %i,%i,%i \n",pGPP_original->user.PowerButtonDc.Action,pGPP_original->user.PowerButtonDc.EventCode,pGPP_original->user.PowerButtonDc.Flags);//7,0,0
+ //printf("Old: %i,%i,%i \n",pGPP_original->user.SleepButtonAc.Action,pGPP_original->user.SleepButtonAc.EventCode,pGPP_original->user.SleepButtonAc.Flags);//7,0,0
+ //printf("Old: %i,%i,%i \n",pGPP_original->user.SleepButtonDc.Action,pGPP_original->user.SleepButtonDc.EventCode,pGPP_original->user.SleepButtonDc.Flags);//7,0,0
+ //printf("Old: %i \n",pPP_original->mach.DozeS4TimeoutAc);//0
+ //printf("Old: %i \n",pPP_original->mach.DozeS4TimeoutDc);//0
+ //printf("Old: %i \n",pPP_original->mach.DozeTimeoutAc);//0
+ //printf("Old: %i \n",pPP_original->mach.DozeTimeoutDc);//0
+ //printf("Old: %i \n",pPP_original->mach.MinSleepAc);//1
+ //printf("Old: %i \n",pPP_original->mach.MinSleepDc);//1
+ //printf("Old: %i \n",pPP_original->mach.MinThrottleAc);//0
+ //printf("Old: %i \n",pPP_original->mach.MinThrottleDc);//0
+ //printf("Old: %i,%i,%i \n",pPP_original->mach.OverThrottledAc.Action,pPP_original->mach.OverThrottledAc.EventCode,pPP_original->mach.OverThrottledAc.Flags);//0,0,0
+ //printf("Old: %i,%i,%i \n",pPP_original->mach.OverThrottledDc.Action,pPP_original->mach.OverThrottledDc.EventCode,pPP_original->mach.OverThrottledDc.Flags);//0,0,0
+ //printf("Old: %i \n",pPP_original->mach.ReducedLatencySleepAc);//1
+ //printf("Old: %i \n",pPP_original->mach.ReducedLatencySleepDc);//1
+ //printf("Old: %i \n",pPP_original->user.FanThrottleToleranceAc);//0
+ //printf("Old: %i \n",pPP_original->user.FanThrottleToleranceDc);//0
+ //printf("Old: %i \n",pPP_original->user.ForcedThrottleAc);//0
+ //printf("Old: %i \n",pPP_original->user.ForcedThrottleDc);//0
+ //printf("Old: %i,%i,%i \n",pPP_original->user.IdleAc.Action,pPP_original->user.IdleAc.EventCode,pPP_original->user.IdleAc.Flags);//0,0,0
+ //printf("Old: %i,%i,%i \n",pPP_original->user.IdleDc.Action,pPP_original->user.IdleDc.EventCode,pPP_original->user.IdleDc.Flags);//0,0,0
+ //printf("Old: %i \n",pPP_original->user.IdleSensitivityAc);//0
+ //printf("Old: %i \n",pPP_original->user.IdleSensitivityDc);//0
+ //printf("Old: %i \n",pPP_original->user.IdleTimeoutAc);//0
+ //printf("Old: %i \n",pPP_original->user.IdleTimeoutDc);//0
+ //printf("Old: %i \n",pPP_original->user.MaxSleepAc);//1
+ //printf("Old: %i \n",pPP_original->user.MaxSleepDc);//1
+ //printf("Old: %i \n",pPP_original->user.OptimizeForPowerAc);//0
+ //printf("Old: %i \n",pPP_original->user.OptimizeForPowerDc);//0
+ //printf("Old: %i \n",pPP_original->user.SpindownTimeoutAc);//0
+ //printf("Old: %i \n",pPP_original->user.SpindownTimeoutDc);//0
+ //printf("Old: %i \n",pPP_original->user.ThrottlePolicyAc);//0
+ //printf("Old: %i \n",pPP_original->user.ThrottlePolicyDc);//0
+ //printf("Old: %i \n",pPP_original->user.VideoTimeoutAc);//0
+ //printf("Old: %i \n",pPP_original->user.VideoTimeoutDc);//0
+
+ pPP_original->mach.MinSleepAc=4;
+ pPP_original->mach.MinSleepDc=4;
+ pPP_original->user.MaxSleepAc=4;
+ pPP_original->user.MaxSleepDc=4;
+ pPP_original->user.OptimizeForPowerAc=1;
+ pPP_original->user.OptimizeForPowerDc=1;
+
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.LidOpenWakeAc=4;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.LidOpenWakeAc=4;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.LidOpenWakeAc=4;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->mach.LidOpenWakeAc=PowerSystemWorking;
+
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.LidOpenWakeDc=4;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.LidOpenWakeDc=4;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.mach.LidOpenWakeDc=4;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->mach.LidOpenWakeDc=PowerSystemWorking;
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.LidCloseAc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.LidCloseAc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject;
+
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.LidCloseDc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.LidCloseDc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject;
+
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.PowerButtonAc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.PowerButtonAc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->user.PowerButtonAc.Action=PowerActionNone;
+
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.PowerButtonDc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.PowerButtonDc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject;
+
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.SleepButtonAc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.SleepButtonAc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject;
+
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.SleepButtonDc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ gpp_compare.user.SleepButtonDc.Action=2;
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject;
+
+
+ pPP_original->mach.MinSleepAc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepAc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->mach.MinSleepAc=PowerSystemSleeping3;
+
+
+ pPP_original->mach.MinSleepDc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.MinSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.MinSleepDc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->mach.MinSleepDc=PowerSystemSleeping3;
+
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledAc.Action=4;
+ pp_compare.mach.OverThrottledAc.Action=2;
+ pp_compare.mach.pad1[2]=2;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.OverThrottledAc.Action=2;
+ pp_compare.mach.pad1[2]=2;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->mach.OverThrottledAc.Action=PowerActionNone;
+
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledDc.Action=4;
+ pp_compare.mach.OverThrottledDc.Action=2;
+ pp_compare.mach.OverThrottledAc.Action=0;
+ pp_compare.mach.pad1[2]=0;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.OverThrottledDc.Action=2;
+ pp_compare.mach.OverThrottledAc.Action=0;
+ pp_compare.mach.pad1[2]=0;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.OverThrottledDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->mach.OverThrottledDc.Action=PowerActionNone;
+
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.ReducedLatencySleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->mach.ReducedLatencySleepAc=PowerSystemWorking;
+
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.mach.ReducedLatencySleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->mach.ReducedLatencySleepDc=PowerSystemWorking;
+
+
+ pPP_original->user.IdleAc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleAc.Action=4;
+ pp_compare.user.IdleAc.Action=2;
+ //pp_compare.user.pad1[2]=2;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.IdleAc.Action=2;
+ //pp_compare.user.pad1[2]=2;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleAc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleAc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->user.IdleAc.Action=PowerActionNone;
+
+
+
+ pPP_original->user.IdleDc.Action=PowerActionNone-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionNone-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionNone;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionReserved;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleDc.Action=4;
+ pp_compare.user.IdleDc.Action=2;
+ // pp_compare.user.pad1[2]=2;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionSleep;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.IdleDc.Action=2;
+ // pp_compare.user.pad1[2]=2;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionShutdownReset;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.IdleDc.Action=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionShutdownOff;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionWarmEject;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionWarmEject+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.IdleDc.Action=PowerActionWarmEject+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->user.IdleDc.Action=PowerActionNone;
+
+
+ pPP_original->user.MaxSleepAc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepAc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepAc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->user.MaxSleepAc=PowerSystemSleeping3;
+
+
+ pPP_original->user.MaxSleepDc=PowerSystemUnspecified-2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemUnspecified-1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemUnspecified;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(!ret, "function was expected to fail\n");
+ ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ //pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemWorking;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemSleeping1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemSleeping2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemSleeping3;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemHibernate;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemShutdown;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemMaximum;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemMaximum+1;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+
+ pPP_original->user.MaxSleepDc=PowerSystemMaximum+2;
+ memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+ memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+ memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+ ret = ValidatePowerPolicies(&gpp,&pp);
+ ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+ ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+ pp_compare.user.MaxSleepDc=4;
+ ok(compare(pp,pp_compare),"Difference Found\n");
+ pPP_original->user.MaxSleepDc=PowerSystemSleeping3;
+
+ }
+
+ void test_WriteGlobalPwrPolicy(void)
+ {
+ // WriteGlobalPwrPolicy(&gpp);
+ }
+
+ void test_WriteProcessorPwrScheme(void)
+ {
+ // WriteProcessorPwrScheme(0,&mppp);
+ }
+
+ void test_WritePwrScheme(void)
+ {
+ DWORD retval;
+ HKEY hSubKey;
+ LONG lSize;
+ LONG Err;
+ WCHAR szPath[MAX_PATH];
+ static const WCHAR szTestSchemeName[] = {'P','o','w','r','p','r','o','f',0};
+ static const WCHAR szTestSchemeDesc[] = {'P','o','w','r','p','r','o','f',' ','S','c','h','e','m','e',0};
+
+ /*
+ * create a temporarly profile, will be deleted in test_DeletePwrScheme
+ */
+
+ retval = WritePwrScheme(&g_TempPwrScheme, (LPWSTR)szTestSchemeName, (LPWSTR)szTestSchemeDesc, &g_PowerPolicy);
+ ok(retval, "Warning: function should have succeeded\n");
+ if (RegOpenKeyW(HKEY_LOCAL_MACHINE, szMachPowerPoliciesSubKey, &hSubKey) == ERROR_SUCCESS)
+ {
+ lSize = MAX_PATH * sizeof(WCHAR);
+ Err = RegQueryValueW(hSubKey, szTempPwrScheme, szPath, &lSize);
+ if (Err != STATUS_SUCCESS)
+ printf("#1 failed to query subkey %i (testentry)\n", g_TempPwrScheme);
+ RegCloseKey(hSubKey);
- }
++}
+
+ }
+
+ void func_power(void)
+ {
+ test_CallNtPowerInformation();
+ test_CanUserWritePwrScheme();
+ test_EnumPwrSchemes();
+ test_GetSetActivePwrScheme();
+ test_ReadPwrScheme();
+ test_WritePwrScheme();
+ test_DeletePwrScheme();
+ test_GetPwrDiskSpindownRange();
+
+ test_GetCurrentPowerPolicies();
+
+ test_GetPwrCapabilities();
+ test_IsAdminOverrideActive();
+ test_IsPwrHibernateAllowed();
+ test_IsPwrShutdownAllowed();
+ test_IsPwrSuspendAllowed();
+ test_ReadGlobalPwrPolicy();
+ test_ReadProcessorPwrScheme();
+ test_SetSuspendState();
+ test_ValidatePowerPolicies_Old();
+ test_ValidatePowerPolicies();
+ test_WriteGlobalPwrPolicy();
+ test_WriteProcessorPwrScheme();
}
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="psapi_winetest" type="win32cui" installbase="bin" installname="psapi_winetest.exe" allowwarnings="true">
- <include base="psapi_winetest">.</include>
+ <include base="psapi_winetest">.</include>
- <define name="__USE_W32API" />
- <library>kernel32</library>
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
- <library>psapi</library>
- <file>testlist.c</file>
- <file>psapi_main.c</file>
+ <library>ntdll</library>
+ <library>psapi</library>
+ <file>testlist.c</file>
+ <file>psapi_main.c</file>
</module>
- </group>
SetLastError(0xdeadbeef);
if(!pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath)))
{
- if(GetLastError() == ERROR_INVALID_FUNCTION)
- trace("GetProcessImageFileName not implemented\n");
- else if(GetLastError() == 0xdeadbeef)
- ok(0, "failed without error code\n");
- else
- ok(0, "failed with %d\n", GetLastError());
-
+ if(GetLastError() == ERROR_INVALID_FUNCTION) {
+ win_skip("GetProcessImageFileName not implemented\n");
- return;
- }
-
+ return;
+ }
+
- w32_err(pGetProcessImageFileNameA(NULL, szImgPath, sizeof(szImgPath)), ERROR_INVALID_HANDLE);
- w32_err(pGetProcessImageFileNameA(hpSR, szImgPath, sizeof(szImgPath)), ERROR_ACCESS_DENIED);
- w32_err(pGetProcessImageFileNameA(hpQI, szImgPath, 0), ERROR_INSUFFICIENT_BUFFER);
- if(!w32_suc(ret = pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) ||
- !w32_suc(pGetMappedFileNameA(hpQV, hMod, szMapPath, sizeof(szMapPath))))
- return;
+ if(GetLastError() == 0xdeadbeef)
+ todo_wine ok(0, "failed without error code\n");
+ else
+ todo_wine ok(0, "failed with %d\n", GetLastError());
+ }
+
+ todo_wine w32_err(pGetProcessImageFileNameA(NULL, szImgPath, sizeof(szImgPath)), ERROR_INVALID_HANDLE);
+ todo_wine w32_err(pGetProcessImageFileNameA(hpSR, szImgPath, sizeof(szImgPath)), ERROR_ACCESS_DENIED);
+ todo_wine w32_err(pGetProcessImageFileNameA(hpQI, szImgPath, 0), ERROR_INSUFFICIENT_BUFFER);
+ todo_wine
+ if(w32_suc(ret = pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) &&
+ w32_suc(pGetMappedFileNameA(hpQV, hMod, szMapPath, sizeof(szMapPath)))) {
- /* Windows returns 2*strlen-1 */
- ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret);
- ok(!strcmp(szImgPath, szMapPath),
- "szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath);
- }
+ /* Windows returns 2*strlen-1 */
+ ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret);
+ ok(!strcmp(szImgPath, szMapPath),
+ "szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath);
+}
+ w32_err(pGetProcessImageFileNameW(NULL, szImgPathW, sizeof(szImgPathW)), ERROR_INVALID_HANDLE);
+ /* no information about correct buffer size returned: */
+ w32_err(pGetProcessImageFileNameW(hpQI, szImgPathW, 0), ERROR_INSUFFICIENT_BUFFER);
+ w32_err(pGetProcessImageFileNameW(hpQI, NULL, 0), ERROR_INSUFFICIENT_BUFFER);
+
+ /* correct call */
+ memset(szImgPathW, 0xff, sizeof(szImgPathW));
+ ret = pGetProcessImageFileNameW(hpQI, szImgPathW, sizeof(szImgPathW)/sizeof(WCHAR));
+ ok(ret > 0, "GetProcessImageFileNameW should have succeeded.\n");
+ ok(szImgPathW[0] == '\\', "GetProcessImageFileNameW should have returned an NT path.\n");
+ expect_eq_d(lstrlenW(szImgPathW), ret);
+
+ /* boundary values of 'size' */
+ w32_err(pGetProcessImageFileNameW(hpQI, szImgPathW, ret), ERROR_INSUFFICIENT_BUFFER);
+
+ memset(szImgPathW, 0xff, sizeof(szImgPathW));
+ ret = pGetProcessImageFileNameW(hpQI, szImgPathW, ret + 1);
+ ok(ret > 0, "GetProcessImageFileNameW should have succeeded.\n");
+ ok(szImgPathW[0] == '\\', "GetProcessImageFileNameW should have returned an NT path.\n");
+ expect_eq_d(lstrlenW(szImgPathW), ret);
+ }
+
static void test_GetModuleFileNameEx(void)
{
HMODULE hMod = GetModuleHandle(NULL);
int i;
for (i = 0; i < num_tests; i++) {
- if (find[i]._todo_wine) {
- todo_wine {
- check_EM_FINDTEXT(hwnd, name, &find[i], i);
- check_EM_FINDTEXTEX(hwnd, name, &find[i], i);
- }
-}
+ check_EM_FINDTEXT(hwnd, name, &find[i], i);
+ check_EM_FINDTEXTEX(hwnd, name, &find[i], i);
+ }
- } else {
- check_EM_FINDTEXT(hwnd, name, &find[i], i);
- check_EM_FINDTEXTEX(hwnd, name, &find[i], i);
+ }
- }
- }
static void test_EM_FINDTEXT(void)
{
memset(buf, 0, sizeof(buf));
SendMessage(hwndRichEdit, EM_STREAMOUT,
(WPARAM)(SF_RTF), (LPARAM)&es);
- trace("EM_STREAMOUT produced:\n%s\n", (char *)buf);
+ trace("EM_STREAMOUT produced: \n%s\n", (char *)buf);
+ /* !ST_SELECTION && !Unicode && \rtf */
setText.codepage = CP_ACP;/* EM_STREAMOUT saved as ANSI string */
getText.codepage = 1200; /* no constant for unicode */
getText.cb = MAX_BUF_LEN;
cr.cpMax = setsel->max;
result = SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) &cr);
- if (setsel->_exsetsel_todo_wine) {
- todo_wine {
- ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
+ ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
- }
- } else {
- ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
- }
SendMessage(hwnd, EM_GETSEL, (WPARAM) &start, (LPARAM) &end);
hdc = GetDC(hwndRichEdit);
ok(hdc != NULL, "Could not get HDC\n");
- fr.hdc = fr.hdcTarget = hdc;
- fr.rc.top = fr.rcPage.top = fr.rc.left = fr.rcPage.left = 0;
+ /* Calculate the twips per pixel */
+ tpp_x = 1440 / GetDeviceCaps(hdc, LOGPIXELSX);
+ tpp_y = 1440 / GetDeviceCaps(hdc, LOGPIXELSY);
+
+ SendMessage(hwndRichEdit, EM_FORMATRANGE, FALSE, 0);
+
+ for (i = 0; i < sizeof(fmtstrings)/sizeof(fmtstrings[0]); i++)
+ {
+ FORMATRANGE fr;
+ GETTEXTLENGTHEX gtl;
+ SIZE stringsize;
+ int r, len;
+
+ SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) fmtstrings[i].string);
+
+ gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
+ gtl.codepage = CP_ACP;
+ len = SendMessageA(hwndRichEdit, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
+
+ /* Get some size information for the string */
+ GetTextExtentPoint32(hdc, fmtstrings[i].string, strlen(fmtstrings[i].string), &stringsize);
+
+ /* Define the box to be half the width needed and a bit larger than the height.
+ * Changes to the width means we have at least 2 pages. Changes to the height
+ * is done so we can check the changing of fr.rc.bottom.
+ */
- fr.rc.right = fr.rcPage.right = GetDeviceCaps(hdc, HORZRES);
- fr.rc.bottom = fr.rcPage.bottom = GetDeviceCaps(hdc, VERTRES);
- fr.chrg.cpMin = 0;
- fr.chrg.cpMax = 20;
+ fr.hdc = fr.hdcTarget = hdc;
+ fr.rc.top = fr.rcPage.top = fr.rc.left = fr.rcPage.left = 0;
+ fr.rc.right = fr.rcPage.right = (stringsize.cx / 2) * tpp_x;
+ fr.rc.bottom = fr.rcPage.bottom = (stringsize.cy + 10) * tpp_y;
- r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) NULL);
+ r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, 0);
- todo_wine {
+ todo_wine {
- ok(r == 31, "EM_FORMATRANGE expect %d, got %d\n", 31, r);
+ ok(r == len, "Expected %d, got %d\n", len, r);
- }
+ }
- r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) &fr);
- todo_wine {
+ /* We know that the page can't hold the full string. See how many characters
+ * are on the first one
+ */
+ fr.chrg.cpMin = 0;
+ fr.chrg.cpMax = -1;
- ok(r == 20, "EM_FORMATRANGE expect %d, got %d\n", 20, r);
+ r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) &fr);
+ todo_wine {
- }
+ ok(fr.rc.bottom == (stringsize.cy * tpp_y), "Expected bottom to be %d, got %d\n", (stringsize.cy * tpp_y), fr.rc.bottom);
+ }
+ if (fmtstrings[i].first)
+ todo_wine {
+ ok(r == fmtstrings[i].first, "Expected %d, got %d\n", fmtstrings[i].first, r);
+ }
+ else
+ ok(r < len, "Expected < %d, got %d\n", len, r);
- fr.chrg.cpMin = 0;
- fr.chrg.cpMax = 10;
-
+ /* Do another page */
+ fr.chrg.cpMin = r;
- r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) &fr);
+ r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) &fr);
+ if (fmtstrings[i].second)
- todo_wine {
+ todo_wine {
- ok(r == 10, "EM_FORMATRANGE expect %d, got %d\n", 10, r);
+ ok(r == fmtstrings[i].second, "Expected %d, got %d\n", fmtstrings[i].second, r);
- }
+ }
+ else
+ ok (r < len, "Expected < %d, got %d\n", len, r);
+
+ /* There is at least on more page, but we don't care */
- r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) NULL);
+ r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, 0);
- todo_wine {
+ todo_wine {
- ok(r == 31, "EM_FORMATRANGE expect %d, got %d\n", 31, r);
+ ok(r == len, "Expected %d, got %d\n", len, r);
- }
++ }
}
+ ReleaseDC(NULL, hdc);
DestroyWindow(hwndRichEdit);
}
char buffer[64] = {0};
/* single line */
- hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
- 0, 0, 200, 60, 0, 0, 0, 0);
+ if (!is_win9x)
+ hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
+ 0, 0, 200, 60, 0, 0, 0, 0);
+ else
+ hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP,
+ 0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
DestroyWindow(hwnd);
/* multi line */
- hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE,
- 0, 0, 200, 60, 0, 0, 0, 0);
+ if (!is_win9x)
+ hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE,
+ 0, 0, 200, 60, 0, 0, 0, 0);
+ else
+ hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP | ES_MULTILINE,
+ 0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
char buffer[64] = {0};
/* multi-line control inserts CR normally */
- hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
- 0, 0, 200, 60, 0, 0, 0, 0);
+ if (!is_win9x)
+ hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
+ 0, 0, 200, 60, 0, 0, 0, 0);
+ else
+ hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP|ES_MULTILINE,
+ 0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
result = SendMessage(hwnd, EM_CANUNDO, 0, 0);
/* one two |three */
SendMessage(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
ok(sel_start == sel_end, "Selection should be empty\n");
- ok(sel_start == 9, "Cursur is at %d instead of %d\n", sel_start, 9);
+ ok(sel_start == 9, "Cursor is at %d instead of %d\n", sel_start, 9);
+
+ /* Test with a custom word break procedure that uses X as the delimiter. */
+ result = SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"one twoXthree");
+ ok (result == TRUE, "Failed to clear the text.\n");
+ SendMessage(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)customWordBreakProc);
+ /* |one twoXthree */
+ SEND_CTRL_RIGHT(hwnd);
+ /* one twoX|three */
+ SendMessage(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
+ ok(sel_start == sel_end, "Selection should be empty\n");
+ ok(sel_start == 8, "Cursor is at %d instead of %d\n", sel_start, 8);
+
+ DestroyWindow(hwnd);
+
+ /* Make sure the behaviour is the same with a unicode richedit window,
+ * and using unicode functions. */
+ if (is_win9x)
+ {
+ skip("Cannot test with unicode richedit window\n");
+ return;
- }
++}
+
+ hwnd = CreateWindowW(RICHEDIT_CLASS20W, NULL,
+ ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+
+ /* Test with a custom word break procedure that uses X as the delimiter. */
+ result = SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW);
+ ok (result == TRUE, "Failed to clear the text.\n");
+ SendMessageW(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)customWordBreakProc);
+ /* |one twoXthree */
+ SEND_CTRL_RIGHT(hwnd);
+ /* one twoX|three */
+ SendMessageW(hwnd, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
+ ok(sel_start == sel_end, "Selection should be empty\n");
+ ok(sel_start == 8, "Cursor is at %d instead of %d\n", sel_start, 8);
DestroyWindow(hwnd);
}
DestroyWindow(hwnd);
}
- START_TEST( editor )
+ static void test_word_wrap(void)
+ {
+ HWND hwnd;
+ POINTL point = {0, 60}; /* This point must be below the first line */
+ const char *text = "Must be long enough to test line wrapping";
+ DWORD dwCommonStyle = WS_VISIBLE|WS_POPUP|WS_VSCROLL|ES_MULTILINE;
+ int res, pos, lines;
+
+ /* Test the effect of WS_HSCROLL and ES_AUTOHSCROLL styles on wrapping
+ * when specified on window creation and set later. */
+ hwnd = CreateWindow(RICHEDIT_CLASS, NULL, dwCommonStyle,
+ 0, 0, 200, 80, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "error: %d\n", (int) GetLastError());
+ res = SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) text);
+ ok(res, "WM_SETTEXT failed.\n");
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos);
+ lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+ ok(lines > 1, "Line was expected to wrap (lines=%d).\n", lines);
+
+ SetWindowLongW(hwnd, GWL_STYLE, dwCommonStyle|WS_HSCROLL|ES_AUTOHSCROLL);
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindow(RICHEDIT_CLASS, NULL, dwCommonStyle|WS_HSCROLL,
+ 0, 0, 200, 80, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "error: %d\n", (int) GetLastError());
+
+ res = SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) text);
+ ok(res, "WM_SETTEXT failed.\n");
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+ lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+ ok(lines == 1, "Line wasn't expected to wrap (lines=%d).\n", lines);
+
+ SetWindowLongW(hwnd, GWL_STYLE, dwCommonStyle);
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindow(RICHEDIT_CLASS, NULL, dwCommonStyle|ES_AUTOHSCROLL,
+ 0, 0, 200, 80, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "error: %d\n", (int) GetLastError());
+ res = SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) text);
+ ok(res, "WM_SETTEXT failed.\n");
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+
+ SetWindowLongW(hwnd, GWL_STYLE, dwCommonStyle);
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindow(RICHEDIT_CLASS, NULL,
+ dwCommonStyle|WS_HSCROLL|ES_AUTOHSCROLL,
+ 0, 0, 200, 80, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "error: %d\n", (int) GetLastError());
+ res = SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) text);
+ ok(res, "WM_SETTEXT failed.\n");
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+
+ SetWindowLongW(hwnd, GWL_STYLE, dwCommonStyle);
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+
+ /* Test the effect of EM_SETTARGETDEVICE on word wrap. */
+ res = SendMessage(hwnd, EM_SETTARGETDEVICE, 0, 1);
+ ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res);
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+
+ res = SendMessage(hwnd, EM_SETTARGETDEVICE, 0, 0);
+ ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res);
+ pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
+ ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos);
+ DestroyWindow(hwnd);
+
+ /* Test to see if wrapping happens with redraw disabled. */
+ hwnd = CreateWindow(RICHEDIT_CLASS, NULL, dwCommonStyle,
+ 0, 0, 400, 80, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "error: %d\n", (int) GetLastError());
+ SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+ res = SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) text);
+ ok(res, "EM_REPLACESEL failed.\n");
+ lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+ ok(lines == 1, "Line wasn't expected to wrap (lines=%d).\n", lines);
+ MoveWindow(hwnd, 0, 0, 200, 80, FALSE);
+ lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+ ok(lines > 1, "Line was expected to wrap (lines=%d).\n", lines);
+
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ DestroyWindow(hwnd);
+ }
+
+ static void test_autoscroll(void)
+ {
+ HWND hwnd = new_richedit(NULL);
+ int lines, ret, redraw;
+ POINT pt;
+
+ for (redraw = 0; redraw <= 1; redraw++) {
+ trace("testing with WM_SETREDRAW=%d\n", redraw);
+ SendMessage(hwnd, WM_SETREDRAW, redraw, 0);
+ SendMessage(hwnd, EM_REPLACESEL, 0, (LPARAM)"1\n2\n3\n4\n5\n6\n7\n8");
+ lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+ ok(lines == 8, "%d lines instead of 8\n", lines);
+ ret = SendMessage(hwnd, EM_GETSCROLLPOS, 0, (LPARAM)&pt);
+ ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
+ ok(pt.y != 0, "Didn't scroll down after replacing text.\n");
+ ret = GetWindowLong(hwnd, GWL_STYLE);
+ ok(ret & WS_VSCROLL, "Scrollbar was not shown yet (style=%x).\n", (UINT)ret);
+
+ SendMessage(hwnd, WM_SETTEXT, 0, 0);
+ lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+ ok(lines == 1, "%d lines instead of 1\n", lines);
+ ret = SendMessage(hwnd, EM_GETSCROLLPOS, 0, (LPARAM)&pt);
+ ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
+ ok(pt.y == 0, "y scroll position is %d after clearing text.\n", pt.y);
+ ret = GetWindowLong(hwnd, GWL_STYLE);
+ ok(!(ret & WS_VSCROLL), "Scrollbar is still shown (style=%x).\n", (UINT)ret);
+ }
+
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ DestroyWindow(hwnd);
+
+ /* The WS_VSCROLL and WS_HSCROLL styles implicitly set
+ * auto vertical/horizontal scrolling options. */
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP|ES_MULTILINE|WS_VSCROLL|WS_HSCROLL,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ ret = SendMessage(hwnd, EM_GETOPTIONS, 0, 0);
+ ok(ret & ECO_AUTOVSCROLL, "ECO_AUTOVSCROLL isn't set.\n");
+ ok(ret & ECO_AUTOHSCROLL, "ECO_AUTOHSCROLL isn't set.\n");
+ ret = GetWindowLong(hwnd, GWL_STYLE);
+ ok(!(ret & ES_AUTOVSCROLL), "ES_AUTOVSCROLL is set.\n");
+ ok(!(ret & ES_AUTOHSCROLL), "ES_AUTOHSCROLL is set.\n");
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP|ES_MULTILINE,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ ret = SendMessage(hwnd, EM_GETOPTIONS, 0, 0);
+ ok(!(ret & ECO_AUTOVSCROLL), "ECO_AUTOVSCROLL is set.\n");
+ ok(!(ret & ECO_AUTOHSCROLL), "ECO_AUTOHSCROLL is set.\n");
+ ret = GetWindowLong(hwnd, GWL_STYLE);
+ ok(!(ret & ES_AUTOVSCROLL), "ES_AUTOVSCROLL is set.\n");
+ ok(!(ret & ES_AUTOHSCROLL), "ES_AUTOHSCROLL is set.\n");
+ DestroyWindow(hwnd);
+ }
+
+
+ static void test_format_rect(void)
+ {
+ HWND hwnd;
+ RECT rc, expected, clientRect;
+ int n;
+ DWORD options;
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+
+ GetClientRect(hwnd, &clientRect);
+
+ expected = clientRect;
+ expected.left += 1;
+ expected.right -= 1;
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ for (n = -3; n <= 3; n++)
+ {
+ rc = clientRect;
+ rc.top += n;
+ rc.left += n;
+ rc.bottom -= n;
+ rc.right -= n;
+ SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+
+ expected = rc;
+ expected.top = max(0, rc.top);
+ expected.left = max(0, rc.left);
+ expected.bottom = min(clientRect.bottom, rc.bottom);
+ expected.right = min(clientRect.right, rc.right);
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "[n=%d] rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ n, rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+ }
+
+ rc = clientRect;
+ SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+ expected = clientRect;
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ /* Adding the selectionbar adds the selectionbar width to the left side. */
+ SendMessageA(hwnd, EM_SETOPTIONS, ECOOP_OR, ECO_SELECTIONBAR);
+ options = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0);
+ ok(options & ECO_SELECTIONBAR, "EM_SETOPTIONS failed to add selectionbar.\n");
+ expected.left += 8; /* selection bar width */
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ rc = clientRect;
+ SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+ expected = clientRect;
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ /* Removing the selectionbar subtracts the selectionbar width from the left side,
+ * even if the left side is already 0. */
+ SendMessageA(hwnd, EM_SETOPTIONS, ECOOP_AND, ~ECO_SELECTIONBAR);
+ options = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0);
+ ok(!(options & ECO_SELECTIONBAR), "EM_SETOPTIONS failed to remove selectionbar.\n");
+ expected.left -= 8; /* selection bar width */
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ /* Set the absolute value of the formatting rectangle. */
+ rc = clientRect;
+ SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+ expected = clientRect;
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "[n=%d] rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ n, rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ /* MSDN documents the EM_SETRECT message as using the rectangle provided in
+ * LPARAM as being a relative offset when the WPARAM value is 1, but these
+ * tests show that this isn't true. */
+ rc.top = 15;
+ rc.left = 15;
+ rc.bottom = clientRect.bottom - 15;
+ rc.right = clientRect.right - 15;
+ expected = rc;
+ SendMessageA(hwnd, EM_SETRECT, 1, (LPARAM)&rc);
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ /* For some reason it does not limit the values to the client rect with
+ * a WPARAM value of 1. */
+ rc.top = -15;
+ rc.left = -15;
+ rc.bottom = clientRect.bottom + 15;
+ rc.right = clientRect.right + 15;
+ expected = rc;
+ SendMessageA(hwnd, EM_SETRECT, 1, (LPARAM)&rc);
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ DestroyWindow(hwnd);
+
+ /* The extended window style affects the formatting rectangle. */
+ hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+
+ GetClientRect(hwnd, &clientRect);
+
+ expected = clientRect;
+ expected.left += 1;
+ expected.top += 1;
+ expected.right -= 1;
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ rc = clientRect;
+ rc.top += 5;
+ rc.left += 5;
+ rc.bottom -= 5;
+ rc.right -= 5;
+ expected = rc;
+ expected.top -= 1;
+ expected.left -= 1;
+ expected.right += 1;
+ SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+ SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc);
+ ok(rc.top == expected.top && rc.left == expected.left &&
+ rc.bottom == expected.bottom && rc.right == expected.right,
+ "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n",
+ rc.top, rc.left, rc.bottom, rc.right,
+ expected.top, expected.left, expected.bottom, expected.right);
+
+ DestroyWindow(hwnd);
+ }
+
+ static void test_WM_GETDLGCODE(void)
{
- MSG msg;
+ HWND hwnd;
+ UINT res, expected;
- time_t end;
+ MSG msg;
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|ES_WANTRETURN|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, 0);
+ expected = expected | DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ msg.message = WM_KEYDOWN;
+ msg.wParam = VK_RETURN;
+ msg.lParam = MapVirtualKey(VK_RETURN, MAPVK_VK_TO_VSC) | 0x0001;
+ msg.pt.x = 0;
+ msg.pt.y = 0;
+ msg.time = GetTickCount();
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|ES_WANTRETURN|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = expected | DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_WANTRETURN|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ msg.wParam = VK_TAB;
+ msg.lParam = MapVirtualKey(VK_TAB, MAPVK_VK_TO_VSC) | 0x0001;
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hold_key(VK_CONTROL);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ release_key(VK_CONTROL);
+
+ msg.wParam = 'a';
+ msg.lParam = MapVirtualKey('a', MAPVK_VK_TO_VSC) | 0x0001;
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ msg.message = WM_CHAR;
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ ES_MULTILINE|WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+ WS_POPUP,
+ 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+ msg.hwnd = hwnd;
+ res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+ expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+ res, expected);
+ DestroyWindow(hwnd);
+ }
+
+ static void test_zoom(void)
+ {
+ HWND hwnd;
+ UINT ret;
+ RECT rc;
+ POINT pt;
+ int numerator, denominator;
+
+ hwnd = new_richedit(NULL);
+ GetClientRect(hwnd, &rc);
+ pt.x = (rc.right - rc.left) / 2;
+ pt.y = (rc.bottom - rc.top) / 2;
+ ClientToScreen(hwnd, &pt);
+
+ /* Test initial zoom value */
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 0, "Numerator should be initialized to 0 (got %d).\n", numerator);
+ ok(denominator == 0, "Denominator should be initialized to 0 (got %d).\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ /* test scroll wheel */
+ hold_key(VK_CONTROL);
+ ret = SendMessage(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(MK_CONTROL, WHEEL_DELTA),
+ MAKELPARAM(pt.x, pt.y));
+ ok(!ret, "WM_MOUSEWHEEL failed (%d).\n", ret);
+ release_key(VK_CONTROL);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 110, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 100, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ /* Test how much the mouse wheel can zoom in and out. */
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)490, (LPARAM)100);
+ ok(ret == TRUE, "EM_SETZOOM failed (%d).\n", ret);
+
+ hold_key(VK_CONTROL);
+ ret = SendMessage(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(MK_CONTROL, WHEEL_DELTA),
+ MAKELPARAM(pt.x, pt.y));
+ ok(!ret, "WM_MOUSEWHEEL failed (%d).\n", ret);
+ release_key(VK_CONTROL);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 500, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 100, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)491, (LPARAM)100);
+ ok(ret == TRUE, "EM_SETZOOM failed (%d).\n", ret);
+
+ hold_key(VK_CONTROL);
+ ret = SendMessage(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(MK_CONTROL, WHEEL_DELTA),
+ MAKELPARAM(pt.x, pt.y));
+ ok(!ret, "WM_MOUSEWHEEL failed (%d).\n", ret);
+ release_key(VK_CONTROL);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 491, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 100, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)20, (LPARAM)100);
+ ok(ret == TRUE, "EM_SETZOOM failed (%d).\n", ret);
+
+ hold_key(VK_CONTROL);
+ ret = SendMessage(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(MK_CONTROL, -WHEEL_DELTA),
+ MAKELPARAM(pt.x, pt.y));
+ ok(!ret, "WM_MOUSEWHEEL failed (%d).\n", ret);
+ release_key(VK_CONTROL);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 10, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 100, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)19, (LPARAM)100);
+ ok(ret == TRUE, "EM_SETZOOM failed (%d).\n", ret);
+
+ hold_key(VK_CONTROL);
+ ret = SendMessage(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(MK_CONTROL, -WHEEL_DELTA),
+ MAKELPARAM(pt.x, pt.y));
+ ok(!ret, "WM_MOUSEWHEEL failed (%d).\n", ret);
+ release_key(VK_CONTROL);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 19, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 100, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ /* Test how WM_SCROLLWHEEL treats our custom denominator. */
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)50, (LPARAM)13);
+ ok(ret == TRUE, "EM_SETZOOM failed (%d).\n", ret);
+
+ hold_key(VK_CONTROL);
+ ret = SendMessage(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(MK_CONTROL, WHEEL_DELTA),
+ MAKELPARAM(pt.x, pt.y));
+ ok(!ret, "WM_MOUSEWHEEL failed (%d).\n", ret);
+ release_key(VK_CONTROL);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 394, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 100, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ /* Test bounds checking on EM_SETZOOM */
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)2, (LPARAM)127);
+ ok(ret == TRUE, "EM_SETZOOM rejected valid values (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)127, (LPARAM)2);
+ ok(ret == TRUE, "EM_SETZOOM rejected valid values (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)2, (LPARAM)128);
+ ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 127, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 2, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)128, (LPARAM)2);
+ ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret);
+
+ /* See if negative numbers are accepted. */
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)-100, (LPARAM)-100);
+ ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret);
+
+ /* See if negative numbers are accepted. */
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)0, (LPARAM)100);
+ ok(ret == FALSE, "EM_SETZOOM failed (%d).\n", ret);
+
+ ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator);
+ ok(numerator == 127, "incorrect numerator is %d\n", numerator);
+ ok(denominator == 2, "incorrect denominator is %d\n", denominator);
+ ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret);
+
+ /* Reset the zoom value */
+ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)0, (LPARAM)0);
+ ok(ret == TRUE, "EM_SETZOOM failed (%d).\n", ret);
+
+ DestroyWindow(hwnd);
+ }
+
+ START_TEST( editor )
+ {
/* Must explicitly LoadLibrary(). The test has no references to functions in
* RICHED20.DLL, so the linker doesn't actually link to it. */
hmoduleRichEdit = LoadLibrary("RICHED20.DLL");
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
- *
- * The message pump uses PeekMessage() to empty the queue and then sleeps for
- * 50ms before retrying the queue. */
- end = time(NULL) + 30;
+ */
if (getenv( "WINETEST_RICHED20" )) {
- while (time(NULL) < end) {
- if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- } else {
- Sleep(50);
+ keep_responsive(30);
- }
+ }
- }
- }
OleFlushClipboard();
ok(FreeLibrary(hmoduleRichEdit) != 0, "error: %d\n", (int) GetLastError());
const struct test winetest_testlist[] =
{
- { "editor", func_editor },
+ { "editor", func_editor },
- { "richole", func_richole },
+ { "txtsrv", func_txtsrv },
{ 0, 0 }
};
ok(!strncmp(dest + expected_bytes_written, origdest
+ expected_bytes_written, nBuf - expected_bytes_written),
"%d: expected_bytes_written=%d\n", i, expected_bytes_written);
- }
- }
+ }
- else
- {
- ok(!strncmp(dest, gl[i].text, expected_bytes_written),
- "%d: expected_bytes_written=%d\n", i, expected_bytes_written);
- ok(!strncmp(dest + expected_bytes_written, origdest
- + expected_bytes_written, nBuf - expected_bytes_written),
- "%d: expected_bytes_written=%d\n", i, expected_bytes_written);
+ }
- }
- }
DestroyWindow(hwndRichEdit);
}
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
- for (i = 0; i < 10; i++) {
+ result = SendMessage(hwndRichEdit, EM_GETLINECOUNT, 0, 0);
+ if (result == 4) {
+ win_skip("Win9x, WinME and NT4 don't handle '\\r only' correctly\n");
+ return;
+ }
+ ok(result == 9, "Incorrect line count of %ld\n", result);
+
+ for (i = 0; i < sizeof(offset_test)/sizeof(offset_test[0]); i++) {
result = SendMessage(hwndRichEdit, EM_LINELENGTH, offset_test[i][0], 0);
ok(result == offset_test[i][1], "Length of line at offset %d is %ld, expected %d\n",
- offset_test[i][0], result, offset_test[i][1]);
+ offset_test[i][0], result, offset_test[i][1]);
}
DestroyWindow(hwndRichEdit);
int i;
for (i = 0; i < num_tests; i++) {
- if (find[i]._todo_wine) {
- todo_wine {
- check_EM_FINDTEXT(hwnd, name, &find[i], i);
- check_EM_FINDTEXTEX(hwnd, name, &find[i], i);
- }
-}
+ check_EM_FINDTEXT(hwnd, name, &find[i], i);
+ check_EM_FINDTEXTEX(hwnd, name, &find[i], i);
+ }
- } else {
- check_EM_FINDTEXT(hwnd, name, &find[i], i);
- check_EM_FINDTEXTEX(hwnd, name, &find[i], i);
+ }
- }
- }
static void test_EM_FINDTEXT(void)
{
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
-
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_I_RPC_HANDLE(void)
{
ptr = NdrPointerMarshall( &StubMsg, memsrc, formattypes );
ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
- ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
- ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled\n", msgpfx);
+ if (srcsize == 8 && wiredatalen == 16 && StubMsg.Buffer - StubMsg.BufferStart == 12)
+ {
+ /* win9x doesn't align 8-byte types properly */
+ wiredatalen = 12;
+ }
+ else
+ {
+ ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+ ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled\n", msgpfx);
+ }
StubMsg.Buffer = StubMsg.BufferStart;
StubMsg.MemorySize = 0;
NdrPointerFree(&StubMsg, mem, formattypes);
/* again pass address of NULL ptr, but pretend we're a server */
- mem = NULL;
- StubMsg.Buffer = StubMsg.BufferStart;
- StubMsg.IsClient = 0;
- ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 );
- ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
- if (formattypes[2] == 0xd /* FC_ENUM16 */)
- ok(mem != StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem points to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
- else
- ok(mem == StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem doesn't point to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
- ok(!cmp(mem, memsrc, size), "%s: incorrectly unmarshaled\n", msgpfx);
- ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
- ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
- if (formattypes[2] != 0xd /* FC_ENUM16 */) {
- ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
- my_alloc_called = 0;
- }
+ if (0) /* crashes on Win9x and NT4 */
+ {
+ mem = NULL;
+ StubMsg.Buffer = StubMsg.BufferStart;
+ StubMsg.IsClient = 0;
+ ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 );
+ ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
+ if (formattypes[2] == 0xd /* FC_ENUM16 */)
+ ok(mem != StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem points to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
+ else
+ ok(mem == StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem doesn't point to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
+ ok(!cmp(mem, memsrc, size), "%s: incorrectly unmarshaled\n", msgpfx);
+ ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+ ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+ if (formattypes[2] != 0xd /* FC_ENUM16 */) {
+ ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
+ my_alloc_called = 0;
}
}
++ }
HeapFree(GetProcessHeap(), 0, mem_orig);
HeapFree(GetProcessHeap(), 0, StubMsg.BufferStart);
}
Passing a NULL ptr while we're a client && !must_alloc
crashes on Windows, so we won't do that. */
- mem = NULL;
- StubMsg.IsClient = 0;
- StubMsg.Buffer = StubMsg.BufferStart;
+ if (0) /* crashes on Win9x and NT4 */
+ {
- ptr = NdrSimpleStructUnmarshall( &StubMsg, &mem, formattypes, 0 );
+ mem = NULL;
+ StubMsg.IsClient = 0;
+ StubMsg.Buffer = StubMsg.BufferStart;
- ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
- ok(mem == StubMsg.BufferStart, "%s: mem not equal buffer\n", msgpfx);
- ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
- ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
- my_alloc_called = 0;
- ok(StubMsg.MemorySize == 0, "%s: memorysize touched in unmarshal\n", msgpfx);
+ ptr = NdrSimpleStructUnmarshall( &StubMsg, &mem, formattypes, FALSE );
+ ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
+ ok(mem == StubMsg.BufferStart, "%s: mem not equal buffer\n", msgpfx);
+ ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
+ ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
+ my_alloc_called = 0;
+ ok(StubMsg.MemorySize == 0, "%s: memorysize touched in unmarshal\n", msgpfx);
+ }
/*** now must_alloc is true ***/
memcpy(wiredata + 20, &c, 1);
test_simple_struct_marshal(fmtstr_pointer_struct + 4, &ps1, 17, wiredata + 4, 17, ps1_cmp, 2, "pointer_struct");
- *(void**)wiredata = &ps1;
- if (0)
+ if (use_pointer_ids)
{
- /* one of the unmarshallings crashes Wine */
+ *(unsigned int *)wiredata = 0x20000;
+ *(unsigned int *)(wiredata + 8) = 0x20004;
+ *(unsigned int *)(wiredata + 12) = 0x20008;
+ }
+ else
+ *(unsigned int *)wiredata = (UINT_PTR)&ps1;
test_pointer_marshal(fmtstr_pointer_struct, &ps1, 17, wiredata, 21, ps1_cmp, 2, "pointer_struct");
-}
+ }
- }
static void test_fullpointer_xlat(void)
{
ok(mem_list_v2->next == NULL, "next %p\n", mem_list_v2->next);
}
}
- else
- {
- trace("v1 mem list format\n");
- mem_list_v1 = StubMsg.pMemoryList;
- ok(mem_list_v1->magic == magic_MEML, "magic %08x\n", mem_list_v1->magic);
- ok(mem_list_v1->ptr == p2, "ptr != p2\n");
- ok(mem_list_v1->next != NULL, "next NULL\n");
- mem_list_v1 = mem_list_v1->next;
- if(mem_list_v1)
- {
- ok(mem_list_v1->magic == magic_MEML, "magic %08x\n", mem_list_v1->magic);
- ok(mem_list_v1->ptr == p1, "ptr != p1\n");
- ok(mem_list_v1->next == NULL, "next %p\n", mem_list_v1->next);
+ else win_skip("v1 mem list format\n");
- }
+ }
- }
- }
/* NdrFree isn't exported so we can't test free'ing */
}
free_list(list);
- name.size = 10;
- name.name = buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, name.size);
- get_name(&name);
- ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer);
- ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name);
- HeapFree(GetProcessHeap(), 0, name.name);
+ if (!old_windows_version)
+ {
+ name.size = 10;
+ name.name = buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, name.size);
+ get_name(&name);
+ ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer);
+ ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name);
+ HeapFree(GetProcessHeap(), 0, name.name);
+ }
pa2 = a;
ok(sum_pcarr2(4, &pa2) == 10, "RPC sum_pcarr2\n");
doub_carr_t *dc;
int *pi;
pints_t api[5];
+ numbers_struct_t *ns;
- ok(cstr_length(str1, sizeof str1) == strlen(str1), "RPC cstr_length\n");
+ if (!old_windows_version)
+ {
+ const char str1[25] = "Hello";
+ ok(cstr_length(str1, sizeof str1) == strlen(str1), "RPC cstr_length\n");
+ }
ok(sum_fixed_int_3d(m) == 4116, "RPC sum_fixed_int_3d\n");
return;
}
- ok(WAIT_OBJECT_0 == WaitForSingleObject(stop_event, 60000), "WaitForSingleObject\n");
+ ret = WaitForSingleObject(stop_event, 1000);
+ ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
+ /* if the stop event didn't fire then RpcMgmtWaitServerListen will wait
+ * forever, so don't bother calling it in this case */
+ if (ret == WAIT_OBJECT_0)
+ {
- status = RpcMgmtWaitServerListen();
- todo_wine {
+ status = RpcMgmtWaitServerListen();
+ todo_wine {
- ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
+ ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
- }
}
}
++}
START_TEST(server)
{
HKEY hkey;
char guid[MAX_PATH];
DWORD size = MAX_PATH;
+ HRESULT ret;
/* Get the MachineGUID */
- RegOpenKeyA(HKEY_LOCAL_MACHINE, szCryptography, &hkey);
+ ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, szCryptography, 0, KEY_READ | KEY_WOW64_64KEY, &hkey);
+ if (ret == ERROR_ACCESS_DENIED)
+ {
+ /* Windows 2000 can't handle KEY_WOW64_64KEY */
+ RegOpenKeyA(HKEY_LOCAL_MACHINE, szCryptography, &hkey);
+ }
RegQueryValueExA(hkey, szMachineGuid, NULL, NULL, (LPBYTE)guid, &size);
RegCloseKey(hkey);
for (i=0; i<sizeof(pbData); i++) pbData[i] = (unsigned char)i;
dwLen = 13;
- result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, pbData, &dwLen, 16);
+ result = CryptEncrypt(hKey, 0, TRUE, 0, pbData, &dwLen, 16);
ok(result, "%08x\n", GetLastError());
-
+
ok(!memcmp(pbData, des3, sizeof(des3)), "3DES encryption failed!\n");
-
+
- result = CryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, pbData, &dwLen);
+ result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen);
ok(result, "%08x\n", GetLastError());
for (i=0; i<4; i++)
*/
ret = pSetupDiInstallClassA(NULL, tmpfile, 0, NULL);
ok(ret, "SetupDiInstallClassA failed: %08x\n", GetLastError());
- if (!RegOpenKeyA(HKEY_LOCAL_MACHINE, classKey_win9x, &hkey))
- {
- /* We are on win9x */
- RegCloseKey(hkey);
- ok(!RegDeleteKeyA(HKEY_LOCAL_MACHINE, classKey_win9x),
- "Couldn't delete win9x classkey\n");
- ok(!RegDeleteKeyA(HKEY_LOCAL_MACHINE, bogus_win9x),
- "Couldn't delete win9x bogus services class\n");
- }
- else
- {
- /* NT4 and above */
+
- ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey),
+ ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey),
- "Couldn't delete NT classkey\n");
- }
+ "Couldn't delete classkey\n");
+
DeleteFile(tmpfile);
}
"SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
pSetupDiDestroyDeviceInfoList(set);
}
- }
+
+ /* The bogus registry key shouldn't be there after this test. The only
+ * reasons this key would still be present:
+ *
+ * - We are running on Wine which has to be fixed
+ * - We have leftovers from old tests
+ */
+ res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
+ todo_wine
+ ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
+ if (res == ERROR_SUCCESS)
+ {
+ DWORD subkeys;
+
+ /* Check if we have subkeys */
+ RegQueryInfoKey(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ if (subkeys > 0)
+ {
+ int i;
+
+ /* Leftovers from old tests */
+ trace("Going to remove %d devices\n", subkeys);
+ for (i = 0; i < subkeys; i++)
+ {
+ BOOL ret;
+
+ ret = remove_device();
+ ok(ret, "Expected a device to be removed\n");
++}
+ }
+ else
+ {
+ /* Wine doesn't delete the bogus key itself currently */
+ trace("We are most likely on Wine\n");
+ RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus);
+ }
+ }
}
static void testGetDeviceInstanceId(void)
ok(i == 2, "expected 2 interfaces, got %d\n", i);
ok(GetLastError() == ERROR_NO_MORE_ITEMS,
"SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError());
- pSetupDiDestroyDeviceInfoList(set);
+ ret = pSetupDiDestroyDeviceInfoList(set);
+ ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError());
+
+ /* Cleanup */
+ /* FIXME: On Wine we still have the bogus entry in Enum\Root and
+ * subkeys, as well as the deviceclass key with subkeys.
+ * Only clean the deviceclass key once Wine if fixed.
+ */
+ if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key))
+ {
+ /* Wine doesn't delete the information currently */
+ trace("We are most likely on Wine\n");
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus);
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass);
- }
++ }
+ else
+ {
+ clean_devclass_key();
- }
++}
}
}
size, &size, NULL);
ok(ret, "SetupDiGetDeviceInterfaceDetailA failed: %d\n",
GetLastError());
- ok(!lstrcmpiA(path, detail->DevicePath), "Unexpected path %s\n",
+ ok(!lstrcmpiA(path, detail->DevicePath) ||
+ !lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n",
- detail->DevicePath);
+ detail->DevicePath);
/* Check SetupDiGetDeviceInterfaceDetailW */
- if (pSetupDiGetDeviceInterfaceDetailW)
- {
- ret = pSetupDiGetDeviceInterfaceDetailW(set, &interfaceData, NULL, 0, &size, NULL);
+ ret = pSetupDiGetDeviceInterfaceDetailW(set, &interfaceData, NULL, 0, &size, NULL);
- ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d\n", GetLastError());
- ok(expectedsize == size, "SetupDiGetDeviceInterfaceDetailW returned wrong reqsize: expected %d, got %d\n", expectedsize, size);
- }
- else
- skip("SetupDiGetDeviceInterfaceDetailW is not available\n");
+ ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
+ "Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d\n", GetLastError());
+ ok(expectedsize == size ||
+ (expectedsize + sizeof(WCHAR)) == size /* W2K adds a backslash */,
+ "SetupDiGetDeviceInterfaceDetailW returned wrong reqsize, got %d\n",
+ size);
HeapFree(GetProcessHeap(), 0, buf);
}
pSetupDiDestroyDeviceInfoList(set);
- }
+
+ /* Cleanup */
+ /* FIXME: On Wine we still have the bogus entry in Enum\Root and
+ * subkeys, as well as the deviceclass key with subkeys.
+ * Only do the RegDeleteKey, once Wine is fixed.
+ */
+ if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key))
+ {
+ /* Wine doesn't delete the information currently */
+ trace("We are most likely on Wine\n");
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus);
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass);
- }
++ }
+ else
+ {
+ clean_devclass_key();
++}
}
}
todo_wine
ok(key == INVALID_HANDLE_VALUE &&
GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
- "Expected ERROR_KEY_DOES_NOT_EXIST_EXIST, got %08x\n", GetLastError());
+ "Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
+ /* The class key shouldn't be there */
+ res = RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key);
+ todo_wine
+ ok(res != ERROR_SUCCESS, "Expected key to not exist\n");
+ RegCloseKey(key);
+ /* Create the device reg key */
key = pSetupDiCreateDevRegKeyW(set, &devInfo, DICS_FLAG_GLOBAL, 0,
DIREG_DRV, NULL, NULL);
- ok(key != INVALID_HANDLE_VALUE, "SetupDiCreateDevRegKey failed: %08x\n",
- GetLastError());
+ /* Vista and higher don't actually create the key */
+ ok(key != INVALID_HANDLE_VALUE || GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
+ "SetupDiCreateDevRegKey failed: %08x\n", GetLastError());
+ if (key != INVALID_HANDLE_VALUE)
+ {
+ classKeyCreated = TRUE;
- RegCloseKey(key);
+ RegCloseKey(key);
+ /* The class key should have been created */
+ ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key),
+ "Expected registry key to exist\n");
+ RegCloseKey(key);
- SetLastError(0xdeadbeef);
- key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
- DIREG_DRV, 0);
- todo_wine
- ok(key == INVALID_HANDLE_VALUE &&
+ SetLastError(0xdeadbeef);
+ key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
+ DIREG_DRV, 0);
+ todo_wine
+ ok(key == INVALID_HANDLE_VALUE &&
- GetLastError() == ERROR_INVALID_DATA,
- "Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
+ (GetLastError() == ERROR_INVALID_DATA ||
+ GetLastError() == ERROR_ACCESS_DENIED), /* win2k3 */
+ "Expected ERROR_INVALID_DATA or ERROR_ACCESS_DENIED, got %08x\n", GetLastError());
- key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
- DIREG_DRV, KEY_READ);
- ok(key != INVALID_HANDLE_VALUE, "SetupDiOpenDevRegKey failed: %08x\n",
- GetLastError());
- pSetupDiDestroyDeviceInfoList(set);
- }
+ key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
+ DIREG_DRV, KEY_READ);
+ ok(key != INVALID_HANDLE_VALUE, "SetupDiOpenDevRegKey failed: %08x\n",
+ GetLastError());
- ret = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo);
+ pSetupDiDestroyDeviceInfoList(set);
+ }
+ else
+ classKeyCreated = FALSE;
+
+ /* Cleanup */
+ ret = remove_device();
+ todo_wine
+ ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
+
+ /* FIXME: Only do the RegDeleteKey, once Wine is fixed */
+ if (!ret)
+ {
+ /* Wine doesn't delete the information currently */
+ trace("We are most likely on Wine\n");
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus);
- devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey);
- }
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey);
+}
+ else if (classKeyCreated)
+ {
+ /* There should only be a class key entry, so a simple
+ * RegDeleteKey should work
+ *
+ * This could fail if it's the first time for this new test
+ * after running the old tests.
+ */
+ ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey),
+ "Couldn't delete classkey\n");
+ }
+ }
+ }
static void testRegisterAndGetDetail(void)
{
ret = pSetupDiGetDeviceInterfaceDetailA(set, &interfaceData,
detail, dwSize, &dwSize, NULL);
ok(ret, "SetupDiGetDeviceInterfaceDetailA failed: %08x\n", GetLastError());
- ok(!lstrcmpiA(path, detail->DevicePath), "Unexpected path %s\n",
+ /* FIXME: This one only worked because old data wasn't removed properly. As soon
+ * as all the tests are cleaned up correctly this has to be (or should be) fixed
+ */
+ todo_wine
+ ok(!lstrcmpiA(path, detail->DevicePath) ||
+ !lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n",
- detail->DevicePath);
+ detail->DevicePath);
HeapFree(GetProcessHeap(), 0, detail);
}
}
pSetupDiDestroyDeviceInfoList(set);
- }
+
+ /* Cleanup */
+ ret = remove_device();
+ todo_wine
+ ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
+
+ /* FIXME: Only do the RegDeleteKey, once Wine is fixed */
+ if (!ret)
+ {
+ /* Wine doesn't delete the information currently */
+ trace("We are most likely on Wine\n");
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus);
+ devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass);
++}
+ else
+ {
+ clean_devclass_key();
+ }
}
- static void testDeviceRegistryPropertyA()
+ static void testDeviceRegistryPropertyA(void)
{
HDEVINFO set;
- GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,
- 0x00,0x11,0x95,0x5c,0x2b,0xdb}};
SP_DEVINFO_DATA devInfo = { sizeof(SP_DEVINFO_DATA), { 0 } };
CHAR devName[] = "LEGACY_BOGUS";
CHAR friendlyName[] = "Bogus";
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
pSetupDiDestroyDeviceInfoList(set);
- }
+
+ res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key);
+ todo_wine
+ ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
+ /* FIXME: Remove when Wine is fixed */
+ if (res == ERROR_SUCCESS)
+ {
+ /* Wine doesn't delete the information currently */
+ trace("We are most likely on Wine\n");
+ RegDeleteKeyA(HKEY_LOCAL_MACHINE, bogus);
++}
}
- static void testDeviceRegistryPropertyW()
+ static void testDeviceRegistryPropertyW(void)
{
HDEVINFO set;
- GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,
- 0x00,0x11,0x95,0x5c,0x2b,0xdb}};
SP_DEVINFO_DATA devInfo = { sizeof(SP_DEVINFO_DATA), { 0 } };
WCHAR devName[] = {'L','E','G','A','C','Y','_','B','O','G','U','S',0};
WCHAR friendlyName[] = {'B','o','g','u','s',0};
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
pSetupDiDestroyDeviceInfoList(set);
- }
+
+ res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
+ todo_wine
+ ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
+ /* FIXME: Remove when Wine is fixed */
+ if (res == ERROR_SUCCESS)
+ {
+ /* Wine doesn't delete the information currently */
+ trace("We are most likely on Wine\n");
+ RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus);
++}
}
START_TEST(devinst)
{
- init_function_pointers();
+ HDEVINFO set;
+
+ init_function_pointers();
- if (pSetupDiCreateDeviceInfoListExW && pSetupDiDestroyDeviceInfoList)
+ /* Win9x/WinMe does things totally different so we skip all the tests
+ *
+ * We don't want to exclude NT4 so hence this check.
+ */
+ SetLastError(0xdeadbeef);
+ set = pSetupDiGetClassDevsW(NULL, NULL, 0, 0);
+ if (set == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("Win9x/WinMe has totally different behavior\n");
+ return;
+ }
+
+ if (pSetupDiCreateDeviceInfoListExW)
test_SetupDiCreateDeviceInfoListEx();
else
- skip("SetupDiCreateDeviceInfoListExW and/or SetupDiDestroyDeviceInfoList not available\n");
+ win_skip("SetupDiCreateDeviceInfoListExW is not available\n");
if (pSetupDiOpenClassRegKeyExA)
test_SetupDiOpenClassRegKeyExA();
{
hSetupAPI = GetModuleHandleA("setupapi.dll");
- pSetupGetField = (void *)GetProcAddress(hSetupAPI, "pSetupGetField");
+ pSetupGetField = (void *)GetProcAddress(hSetupAPI, "pSetupGetField");
+ pSetupEnumInfSectionsA = (void *)GetProcAddress(hSetupAPI, "SetupEnumInfSectionsA" );
}
static const char tmpfilename[] = ".\\tmp.inf";
{
ok( err == 0, "line %u: bad error %u\n", i, err );
if (key_names[i].fields[index])
- ok( !strcmp( field, key_names[i].fields[index] ), "line %u: bad field %s/%s\n",
- i, field, key_names[i].fields[index] );
+ {
+ if (i == 49)
+ ok( !strcmp( field, key_names[i].fields[index] ) ||
+ !strcmp( field, A1200), /* Vista, W2K8 */
+ "line %u: bad field %s/%s\n",
+ i, field, key_names[i].fields[index] );
+ else /* don't compare drive letter of paths */
+ if (field[0] && field[1] == ':' && field[2] == '\\')
+ ok( !strcmp( field + 1, key_names[i].fields[index] + 1 ),
+ "line %u: bad field %s/%s\n",
+ i, field, key_names[i].fields[index] );
+ else
+ ok( !strcmp( field, key_names[i].fields[index] ), "line %u: bad field %s/%s\n",
+ i, field, key_names[i].fields[index] );
+ }
else
ok( 0, "line %u: got extra field %s\n", i, field );
strcat( buffer, "," );
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
/* try an invalid inf filename */
- size = 0xdeadbeef;
- SetLastError(0xbeefcafe);
- ret = SetupGetInfInformationA(NULL, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
- ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
- ok(GetLastError() == ERROR_INVALID_PARAMETER,
- "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
- ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
+ /* do not use NULL as absolute inf filename on win9x (crash) */
+ if ((GetLastError() != ERROR_BAD_PATHNAME) && /* win95 */
+ (GetLastError() != ERROR_FILE_NOT_FOUND)) /* win98 */
+ {
+ size = 0xdeadbeef;
+ SetLastError(0xbeefcafe);
+ ret = SetupGetInfInformationA(NULL, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
+ ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
+ }
- create_inf_file(inf_filename);
+ create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1);
/* try an invalid search flag */
size = 0xdeadbeef;
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="setupapi_winetest" type="win32cui" installbase="bin" installname="setupapi_winetest.exe" allowwarnings="true">
- <include base="setupapi_winetest">.</include>
+ <include base="setupapi_winetest">.</include>
- <define name="__USE_W32API" />
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
- <library>advapi32</library>
- <library>setupapi</library>
- <library>user32</library>
- <file>devclass.c</file>
- <file>devinst.c</file>
- <file>install.c</file>
- <file>misc.c</file>
- <file>parser.c</file>
- <file>query.c</file>
- <file>stringtable.c</file>
- <file>testlist.c</file>
+ <library>ntdll</library>
- <library>kernel32</library>
+ <library>advapi32</library>
+ <library>setupapi</library>
+ <library>user32</library>
+ <file>devclass.c</file>
+ <file>devinst.c</file>
+ <file>install.c</file>
+ <file>misc.c</file>
+ <file>parser.c</file>
+ <file>query.c</file>
+ <file>stringtable.c</file>
+ <file>testlist.c</file>
</module>
- </group>
pStringTableStringFromId = (void*)GetProcAddress(hdll, "pSetupStringTableStringFromId");
}
- static void test_StringTableInitialize(void)
- {
- table=pStringTableInitialize();
- ok(table!=NULL,"Failed to Initialize String Table\n");
- }
-
static void test_StringTableAddString(void)
{
- DWORD retval;
+ DWORD retval, hstring, hString, hfoo;
+ HANDLE table;
+
- table = pStringTableInitialize();
++ table=pStringTableInitialize();
+ ok(table != NULL, "failed to initialize string table\n");
/* case insensitive */
hstring=pStringTableAddString(table,string,0);
static void test_StringTableLookUpString(void)
{
- DWORD retval, retval2;
+ DWORD retval, retval2, hstring, hString, hfoo;
+ HANDLE table, table2;
-
+
+ table = pStringTableInitialize();
+ ok(table != NULL,"failed to initialize string table\n");
+
+ hstring = pStringTableAddString(table, string, 0);
+ ok(hstring != ~0u, "failed to add 'string' to string table\n");
+
+ hString = pStringTableAddString(table, String, 0);
+ ok(hString != ~0u,"failed to add 'String' to string table\n");
+
+ hfoo = pStringTableAddString(table, foo, 0);
+ ok(hfoo != ~0u, "failed to add 'foo' to string table\n");
+
+ table2 = pStringTableDuplicate(table);
+ ok(table2 != NULL, "Failed to duplicate String Table\n");
+
/* case insensitive */
retval=pStringTableLookUpString(table,string,0);
ok(retval!=-1,"Failed find string in String Table 1\n");
retval=pStringTableLookUpString(table,string,ST_CASE_SENSITIVE_COMPARE);
retval2=pStringTableLookUpString(table,String,ST_CASE_SENSITIVE_COMPARE);
ok(retval!=retval2,"Lookup of string equals String in Table 1\n");
- ok(retval2==hString,
+ ok(retval==hString,
"Lookup for String (%x) does not match previous handle (%x) in String Table 1\n",
- retval, hString);
+ retval, hString);
+
+ pStringTableDestroy(table);
+ pStringTableDestroy(table2);
+ }
+
+ static void test_StringTableLookUpStringEx(void)
+ {
+ static WCHAR uilevel[] = {'U','I','L','E','V','E','L',0};
+ DWORD retval, retval2, hstring, hString, hfoo, data;
+ HANDLE table, table2;
+ char buffer[4];
+
+ table = pStringTableInitialize();
+ ok(table != NULL,"Failed to Initialize String Table\n");
+
+ hstring = pStringTableAddString(table, string, 0);
+ ok(hstring != ~0u, "failed to add 'string' to string table\n");
+
+ hString = pStringTableAddString(table, String, 0);
+ ok(hString != ~0u,"failed to add 'String' to string table\n");
+
+ hfoo = pStringTableAddString(table, foo, 0);
+ ok(hfoo != ~0u, "failed to add 'foo' to string table\n");
+
+ table2 = pStringTableDuplicate(table);
+ ok(table2 != NULL, "Failed to duplicate String Table\n");
+
+ /* case insensitive */
+ retval = pStringTableLookUpStringEx(table, string, 0, NULL, 0);
+ ok(retval != ~0u, "Failed find string in String Table 1\n");
+ ok(retval == hstring,
+ "Lookup for string (%x) does not match previous handle (%x) in String Table 1\n",
+ retval, hstring);
+
+ retval = pStringTableLookUpStringEx(table2, string, 0, NULL, 0);
+ ok(retval != ~0u, "Failed find string in String Table 2\n");
+
+ retval = pStringTableLookUpStringEx(table, String, 0, NULL, 0);
+ ok(retval != ~0u, "Failed find String in String Table 1\n");
+
+ retval = pStringTableLookUpStringEx(table2, String, 0, NULL, 0);
+ ok(retval != ~0u, "Failed find String in String Table 2\n");
+
+ retval=pStringTableLookUpStringEx(table, foo, 0, NULL, 0);
+ ok(retval != ~0u, "Failed find foo in String Table 1\n");
+ ok(retval == hfoo,
+ "Lookup for foo (%x) does not match previous handle (%x) in String Table 1\n",
+ retval, hfoo);
+
+ retval = pStringTableLookUpStringEx(table2, foo, 0, NULL, 0);
+ ok(retval != ~0u, "Failed find foo in String Table 2\n");
+
+ /* case sensitive */
+ retval = pStringTableLookUpStringEx(table, string,ST_CASE_SENSITIVE_COMPARE, NULL, 0);
+ retval2 = pStringTableLookUpStringEx(table, String, ST_CASE_SENSITIVE_COMPARE, NULL, 0);
+ ok(retval != retval2, "Lookup of string equals String in Table 1\n");
+ ok(retval == hString,
+ "Lookup for String (%x) does not match previous handle (%x) in String Table 1\n",
+ retval, hString);
+
+ pStringTableDestroy(table);
+
+ table = pStringTableInitializeEx(0x1000, 0);
+ ok(table != NULL, "failed to initialize string table\n");
+
+ data = 0xaaaaaaaa;
+ retval = pStringTableAddStringEx(table, uilevel, 0x5, &data, sizeof(data));
+ ok(retval != ~0u, "failed to add 'UILEVEL' to string table\n");
+
+ memset(buffer, 0x55, sizeof(buffer));
+ retval = pStringTableLookUpStringEx(table, uilevel, ST_CASE_SENSITIVE_COMPARE, buffer, 0);
+ ok(retval != ~0u, "failed find 'UILEVEL' in string table\n");
+ ok(memcmp(buffer, &data, 4), "unexpected data\n");
+
+ memset(buffer, 0x55, sizeof(buffer));
+ retval = pStringTableLookUpStringEx(table, uilevel, ST_CASE_SENSITIVE_COMPARE, buffer, 2);
+ ok(retval != ~0u, "failed find 'UILEVEL' in string table\n");
+ ok(!memcmp(buffer, &data, 2), "unexpected data\n");
+
+ memset(buffer, 0x55, sizeof(buffer));
+ retval = pStringTableLookUpStringEx(table, uilevel, ST_CASE_SENSITIVE_COMPARE, buffer, sizeof(buffer));
+ ok(retval != ~0u, "failed find 'UILEVEL' in string table\n");
+ ok(!memcmp(buffer, &data, 4), "unexpected data\n");
+
+ pStringTableDestroy(table);
}
static void test_StringTableStringFromId(void)
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
-
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_BLOB(void)
{
static GUID CLSID_CommonDocuments = { 0x0000000c, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x1a } };
struct shellExpectedValues {
- int folder;
+ int folder;
- BYTE pidlType;
+ int numTypes;
+ const BYTE *types;
};
static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO *);
{
shellVersion.cbSize = sizeof(shellVersion);
pDllGetVersion(&shellVersion);
- if (winetest_interactive)
- printf("shell32 version is %d.%d\n",
+ trace("shell32 version is %d.%d\n",
- shellVersion.dwMajorVersion, shellVersion.dwMinorVersion);
+ shellVersion.dwMajorVersion, shellVersion.dwMinorVersion);
}
#undef GET_PROC
}
pidlLast->mkid.abID[0] == PT_GUID))
{
GUID *shellGuid = (GUID *)(pidlLast->mkid.abID + 2);
+ char shellGuidStr[39], guidStr[39], guid_altStr[39];
- ok(IsEqualIID(shellGuid, guid),
- "%s: got GUID %s, expected %s\n", getFolderName(folder),
+ if (!guid_alt)
- printGUID(shellGuid), printGUID(guid));
+ ok(IsEqualIID(shellGuid, guid),
+ "%s: got GUID %s, expected %s\n", getFolderName(folder),
+ printGUID(shellGuid, shellGuidStr), printGUID(guid, guidStr));
+ else
+ ok(IsEqualIID(shellGuid, guid) ||
+ IsEqualIID(shellGuid, guid_alt),
+ "%s: got GUID %s, expected %s or %s\n", getFolderName(folder),
+ printGUID(shellGuid, shellGuidStr), printGUID(guid, guidStr),
+ printGUID(guid_alt, guid_altStr));
}
IMalloc_Free(pMalloc, pidl);
}
{
int wait_rc;
wait_rc=WaitForSingleObject(hEvent, 5000);
- ok(wait_rc==WAIT_OBJECT_0, "WaitForSingleObject returned %d\n", wait_rc);
+ if (wait_rc == WAIT_TIMEOUT)
+ {
+ HWND wnd = FindWindowA("#32770", "Windows");
+ if (wnd != NULL)
+ {
+ SendMessage(wnd, WM_CLOSE, 0, 0);
+ win_skip("Skipping shellexecute of file with unassociated extension\n");
+ skip_noassoc_tests = TRUE;
+ rc = SE_ERR_NOASSOC;
- }
++ }
+ }
+ ok(wait_rc==WAIT_OBJECT_0 || rc <= 32, "WaitForSingleObject returned %d\n", wait_rc);
}
/* The child process may have changed the result file, so let profile
* functions know about it
okChildInt("argcA", 4);
okChildString("argvA3", "Exec");
- sprintf(filename, "%s\\test file.noassoc", tmpdir);
- if (CopyFile(argv0, filename, FALSE))
- {
- rc=shell_execute(NULL, filename, params, NULL);
- todo_wine {
- ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc);
- }
+ if (! skip_noassoc_tests)
+ {
+ sprintf(filename, "%s\\test file.noassoc", tmpdir);
+ if (CopyFile(argv0, filename, FALSE))
+ {
+ rc=shell_execute(NULL, filename, params, NULL);
+ todo_wine {
+ ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc);
}
}
+}
+ else
+ {
+ win_skip("Skipping shellexecute of file with unassociated extension\n");
+ }
+ }
static void test_exes_long(void)
{
okChildInt("argcA", 4);
okChildString("argvA3", longparam);
- sprintf(filename, "%s\\test file.noassoc", tmpdir);
- if (CopyFile(argv0, filename, FALSE))
- {
- rc=shell_execute(NULL, filename, params, NULL);
- todo_wine {
- ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc);
- }
+ if (! skip_noassoc_tests)
+ {
+ sprintf(filename, "%s\\test file.noassoc", tmpdir);
+ if (CopyFile(argv0, filename, FALSE))
+ {
+ rc=shell_execute(NULL, filename, params, NULL);
+ todo_wine {
+ ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc);
}
}
+}
+ else
+ {
+ win_skip("Skipping shellexecute of file with unassociated extension\n");
+ }
+ }
typedef struct
{
/* Test unquoted %1 in command and ddeexec
* (test filename has space) */
- {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", 0x0, 33},
+ {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", 0x0},
/* Test ifexec precedence over ddeexec */
- {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]", 0x0, 33},
+ {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]", 0x0},
/* Test default DDE topic */
- {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0, 33},
+ {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0},
/* Test default DDE application */
- {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0, 33},
+ {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0},
- {NULL, NULL, NULL, NULL, NULL, 0, 0x0, 0}
+ {NULL, NULL, NULL, NULL, NULL, 0, 0x0}
};
- static DWORD ddeInst;
- static HSZ hszTopic;
- static char ddeExec[MAX_PATH], ddeApplication[MAX_PATH];
- static BOOL denyNextConnection;
-
- static HDDEDATA CALLBACK ddeCb(UINT uType, UINT uFmt, HCONV hConv,
- HSZ hsz1, HSZ hsz2, HDDEDATA hData,
- ULONG_PTR dwData1, ULONG_PTR dwData2)
+ static DWORD WINAPI hooked_WaitForInputIdle(HANDLE process, DWORD timeout)
{
- DWORD size = 0;
+ HANDLE dde_ready;
+ DWORD wait_result;
- if (winetest_debug > 2)
- trace("dde_cb: %04x, %04x, %p, %p, %p, %p, %08lx, %08lx\n",
- uType, uFmt, hConv, hsz1, hsz2, hData, dwData1, dwData2);
+ dde_ready = CreateEventA(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready");
+ wait_result = WaitForSingleObject(dde_ready, timeout);
+ CloseHandle(dde_ready);
- switch (uType)
+ return wait_result;
+ }
+
+ /*
+ * WaitForInputIdle() will normally return immediately for console apps. That's
+ * a problem for us because ShellExecute will assume that an app is ready to
+ * receive DDE messages after it has called WaitForInputIdle() on that app.
+ * To work around that we install our own version of WaitForInputIdle() that
+ * will wait for the child to explicitly tell us that it is ready. We do that
+ * by changing the entry for WaitForInputIdle() in the shell32 import address
+ * table.
+ */
+ static void hook_WaitForInputIdle(void *new_func)
+ {
+ char *base;
+ PIMAGE_NT_HEADERS nt_headers;
+ DWORD import_directory_rva;
+ PIMAGE_IMPORT_DESCRIPTOR import_descriptor;
+
+ base = (char *) GetModuleHandleA("shell32.dll");
+ nt_headers = (PIMAGE_NT_HEADERS)(base + ((PIMAGE_DOS_HEADER) base)->e_lfanew);
+ import_directory_rva = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
+
+ /* Search for the correct imported module by walking the import descriptors */
+ import_descriptor = (PIMAGE_IMPORT_DESCRIPTOR)(base + import_directory_rva);
+ while (U(*import_descriptor).OriginalFirstThunk != 0)
{
- case XTYP_CONNECT:
- if (!DdeCmpStringHandles(hsz1, hszTopic))
+ char *import_module_name;
+
+ import_module_name = base + import_descriptor->Name;
+ if (lstrcmpiA(import_module_name, "user32.dll") == 0 ||
+ lstrcmpiA(import_module_name, "user32") == 0)
- {
+ {
- if (denyNextConnection)
- denyNextConnection = FALSE;
- else
+ PIMAGE_THUNK_DATA int_entry;
+ PIMAGE_THUNK_DATA iat_entry;
+
+ /* The import name table and import address table are two parallel
+ * arrays. We need the import name table to find the imported
+ * routine and the import address table to patch the address, so
+ * walk them side by side */
+ int_entry = (PIMAGE_THUNK_DATA)(base + U(*import_descriptor).OriginalFirstThunk);
+ iat_entry = (PIMAGE_THUNK_DATA)(base + import_descriptor->FirstThunk);
+ while (int_entry->u1.Ordinal != 0)
- {
++ {
+ if (! IMAGE_SNAP_BY_ORDINAL(int_entry->u1.Ordinal))
{
- size = DdeQueryString(ddeInst, hsz2, ddeApplication, MAX_PATH, CP_WINANSI);
- assert(size < MAX_PATH);
- return (HDDEDATA)TRUE;
+ PIMAGE_IMPORT_BY_NAME import_by_name;
+ import_by_name = (PIMAGE_IMPORT_BY_NAME)(base + int_entry->u1.AddressOfData);
+ if (lstrcmpA((char *) import_by_name->Name, "WaitForInputIdle") == 0)
+ {
+ /* Found the correct routine in the correct imported module. Patch it. */
+ DWORD old_prot;
+ VirtualProtect(&iat_entry->u1.Function, sizeof(ULONG_PTR), PAGE_READWRITE, &old_prot);
+ iat_entry->u1.Function = (ULONG_PTR) new_func;
+ VirtualProtect(&iat_entry->u1.Function, sizeof(ULONG_PTR), old_prot, &old_prot);
+ break;
- }
}
- return (HDDEDATA)FALSE;
-
- case XTYP_EXECUTE:
- size = DdeGetData(hData, (LPBYTE)ddeExec, MAX_PATH, 0L);
- assert(size < MAX_PATH);
- DdeFreeDataHandle(hData);
- return (HDDEDATA)DDE_FACK;
-
- default:
- return NULL;
+ }
- }
+ int_entry++;
+ iat_entry++;
- }
+ }
+ break;
+}
- typedef struct
- {
- char *filename;
- DWORD threadIdParent;
- } dde_thread_info_t;
-
- static DWORD CALLBACK ddeThread(LPVOID arg)
- {
- dde_thread_info_t *info = (dde_thread_info_t *)arg;
- assert(info && info->filename);
- PostThreadMessage(info->threadIdParent,
- WM_QUIT,
- shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL),
- 0L);
- ExitThread(0);
+ import_descriptor++;
- }
++}
}
- /* ShellExecute won't successfully send DDE commands to console applications after starting them,
- * so we run a DDE server in this application, deny the first connection request to make
- * ShellExecute start the application, and then process the next DDE connection in this application
- * to see the execute command that is sent. */
static void test_dde(void)
{
char filename[MAX_PATH], defApplication[MAX_PATH];
ok(file_exists("test1.txt"), "test1.txt should not have been removed\n");
/* try to delete an invalid filename */
- init_shfo_tests();
- shfo.pFrom = "\0";
- shfo.fFlags &= ~FOF_FILESONLY;
- shfo.fAnyOperationsAborted = FALSE;
- ret = SHFileOperation(&shfo);
- ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
- ok(!shfo.fAnyOperationsAborted, "Expected no aborted operations\n");
- ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+ if (0) {
+ /* this crashes on win9x */
+ init_shfo_tests();
+ shfo.pFrom = "\0";
+ shfo.fFlags &= ~FOF_FILESONLY;
+ shfo.fAnyOperationsAborted = FALSE;
+ ret = SHFileOperation(&shfo);
+ ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
+ ok(!shfo.fAnyOperationsAborted, "Expected no aborted operations\n");
+ ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+ }
/* try an invalid function */
init_shfo_tests();
ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
/* try an invalid list, only one null terminator */
- init_shfo_tests();
- shfo.pFrom = "";
- shfo.wFunc = FO_DELETE;
- ret = SHFileOperation(&shfo);
- ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
- ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+ if (0) {
+ /* this crashes on win9x */
+ init_shfo_tests();
+ shfo.pFrom = "";
+ shfo.wFunc = FO_DELETE;
+ ret = SHFileOperation(&shfo);
+ ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
+ ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+ }
+
+ /* delete a nonexistent file */
+ shfo.pFrom = "nonexistent.txt\0";
+ shfo.wFunc = FO_DELETE;
+ ret = SHFileOperation(&shfo);
+ todo_wine
+ ok(ret == 1026 ||
+ ret == ERROR_FILE_NOT_FOUND || /* Vista */
+ broken(ret == ERROR_SUCCESS), /* NT4 */
+ "Expected 1026 or ERROR_FILE_NOT_FOUND, got %d\n", ret);
/* delete a dir, and then a file inside the dir, same as
* deleting a nonexistent file
*/
- init_shfo_tests();
- shfo.pFrom = "testdir2\0testdir2\\one.txt\0";
- ret = SHFileOperation(&shfo);
+ if (ret != ERROR_FILE_NOT_FOUND)
+ {
+ /* Vista would throw up a dialog box that we can't suppress */
- ok(ret == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %d\n", ret);
- ok(!file_exists("testdir2"), "Expected testdir2 to not exist\n");
+ init_shfo_tests();
+ shfo.pFrom = "testdir2\0testdir2\\one.txt\0";
+ ret = SHFileOperation(&shfo);
- ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
+ ok(ret == ERROR_PATH_NOT_FOUND ||
+ broken(ret == ERROR_SUCCESS), /* NT4 */
+ "Expected ERROR_PATH_NOT_FOUND, got %d\n", ret);
+ ok(!dir_exists("testdir2"), "Expected testdir2 to not exist\n");
+ ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
+ }
+ else
+ skip("Test would show a dialog box\n");
/* try the FOF_NORECURSION flag, continues deleting subdirs */
init_shfo_tests();
set_curr_dir_path(from, "test3.txt\0");
set_curr_dir_path(to, "test4.txt\\test1.txt\0");
- ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory\n");
+ retval = SHFileOperationA(&shfo);
+ if (retval == DE_DIFFDIR)
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(!file_exists("test4.txt\\test1.txt"), "The file is renamed\n");
+ }
+ else
+ {
+ ok(retval == ERROR_SUCCESS, "File is renamed moving to other directory\n");
- ok(file_exists("test4.txt\\test1.txt"), "The file is not renamed\n");
+ ok(file_exists("test4.txt\\test1.txt"), "The file is not renamed\n");
+ }
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
/* pFrom is empty */
shfo.pFrom = "\0";
retval = SHFileOperationA(&shfo);
- ok(retval == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", retval);
+ ok(retval == ERROR_ACCESS_DENIED ||
+ retval == DE_MANYSRC1DEST || /* Vista */
+ broken(retval == ERROR_SUCCESS), /* Win9x */
+ "Expected ERROR_ACCESS_DENIED or DE_MANYSRC1DEST, got %d\n", retval);
/* pFrom is NULL, commented out because it crashes on nt 4.0 */
- #if 0
+ if (0)
+ {
- shfo.pFrom = NULL;
- retval = SHFileOperationA(&shfo);
- ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", retval);
- }
+ shfo.pFrom = NULL;
+ retval = SHFileOperationA(&shfo);
+ ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", retval);
- #endif
++}
}
/* tests the FO_COPY action */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
- ok(SHFileOperationA(&shfo), "Can't copy many files\n");
- ok(!file_exists("test6.txt"), "The file is not copied - many files are "
+ retval = SHFileOperationA(&shfo);
+ if (dir_exists("test6.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not copied - many files "
+ "are specified as a target\n");
+ DeleteFileA("test6.txt\\test2.txt");
+ RemoveDirectoryA("test6.txt\\test4.txt");
+ RemoveDirectoryA("test6.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(!file_exists("test6.txt"), "The file is copied - many files are "
- "specified as a target\n");
+ "specified as a target\n");
+ }
memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
shfo2.fFlags |= FOF_MULTIDESTFILES;
/* number of sources do not correspond to number of targets */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0");
- ok(SHFileOperationA(&shfo2), "Can't copy many files\n");
- ok(!file_exists("test6.txt"), "The file is not copied - many files are "
+ retval = SHFileOperationA(&shfo2);
+ if (dir_exists("test6.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_DESTSAMETREE, "Expected DE_DESTSAMETREE, got %d\n", retval);
+ ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not copied - many files "
+ "are specified as a target\n");
+ RemoveDirectoryA("test6.txt");
+ ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not copied - many files "
+ "are specified as a target\n");
+ RemoveDirectoryA("test7.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(!file_exists("test6.txt"), "The file is copied - many files are "
- "specified as a target\n");
+ "specified as a target\n");
+ }
set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0");
set_curr_dir_path(from, "test1.txt\0test2.txt\0");
set_curr_dir_path(to, "test3.txt\0");
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (retval == DE_FLDDESTISFILE)
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
+ ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
+ }
ok(!file_exists("test3.txt\\test2.txt"), "Expected test3.txt\\test2.txt to not exist\n");
/* try to copy many files to nonexistent directory */
DeleteFile(to);
+ shfo.fFlags &= ~FOF_NOERRORUI;
shfo.fAnyOperationsAborted = FALSE;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(DeleteFile("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
- ok(DeleteFile("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
- ok(RemoveDirectory(to), "Expected test3.txt to exist\n");
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
+ ok(DeleteFile("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
+ ok(RemoveDirectory(to), "Expected test3.txt to exist\n");
/* send in FOF_MULTIDESTFILES with too many destination files */
init_shfo_tests();
shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
shfo.fFlags |= FOF_NOERRORUI | FOF_MULTIDESTFILES;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
- ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
+ if (dir_exists("testdir2\\a.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
+ RemoveDirectory("testdir2\\a.txt");
+ ok(DeleteFile("testdir2\\b.txt\\test2.txt"), "Expected testdir2\\b.txt\\test2.txt to exist\n");
+ RemoveDirectory("testdir2\\b.txt");
+ ok(DeleteFile("testdir2\\c.txt\\test3.txt"), "Expected testdir2\\c.txt\\test3.txt to exist\n");
+ RemoveDirectory("testdir2\\c.txt");
+ ok(!file_exists("testdir2\\d.txt"), "Expected testdir2\\d.txt to not exist\n");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(shfo.fAnyOperationsAborted ||
+ broken(!shfo.fAnyOperationsAborted), /* NT4 */
+ "Expected aborted operations\n");
- ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\a.txt to not exist\n");
+ ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\a.txt to not exist\n");
+ }
/* send in FOF_MULTIDESTFILES with too many destination files */
shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
shfo.pTo = "e.txt\0f.txt\0";
shfo.fAnyOperationsAborted = FALSE;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
- ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
+ if (dir_exists("e.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval);
+ ok(DeleteFile("e.txt\\test1.txt"), "Expected e.txt\\test1.txt to exist\n");
+ RemoveDirectory("e.txt");
+ ok(DeleteFile("f.txt\\test2.txt"), "Expected f.txt\\test2.txt to exist\n");
+ RemoveDirectory("f.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(shfo.fAnyOperationsAborted ||
+ broken(!shfo.fAnyOperationsAborted), /* NT4 */
+ "Expected aborted operations\n");
- ok(!file_exists("e.txt"), "Expected e.txt to not exist\n");
+ ok(!file_exists("e.txt"), "Expected e.txt to not exist\n");
+ }
/* use FOF_MULTIDESTFILES with files and a source directory */
shfo.pFrom = "test1.txt\0test2.txt\0test4.txt\0";
shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0";
shfo.fAnyOperationsAborted = FALSE;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(retval == ERROR_SUCCESS ||
+ broken(retval == 0x100a1), /* WinMe */
+ "Expected ERROR_SUCCESS, got %d\n", retval);
ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
ok(DeleteFile("testdir2\\b.txt"), "Expected testdir2\\b.txt to exist\n");
- ok(RemoveDirectory("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
+ if (retval == ERROR_SUCCESS)
+ ok(RemoveDirectory("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
/* try many dest files without FOF_MULTIDESTFILES flag */
shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fFlags &= ~FOF_MULTIDESTFILES;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (dir_exists("a.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("a.txt\\test1.txt"), "Expected a.txt\\test1.txt to exist\n");
+ ok(DeleteFile("a.txt\\test2.txt"), "Expected a.txt\\test2.txt to exist\n");
+ ok(DeleteFile("a.txt\\test3.txt"), "Expected a.txt\\test3.txt to exist\n");
+ RemoveDirectory("a.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
+ ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
+ }
/* try a glob */
shfo.pFrom = "test?.txt\0";
shfo.pTo = "testdir2\0";
shfo.fFlags &= ~FOF_MULTIDESTFILES;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(retval == ERROR_SUCCESS ||
+ broken(retval == 0x100a1), /* WinMe */
+ "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
+ ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
/* try a glob with FOF_FILESONLY */
clean_after_shfo_tests();
shfo.pFrom = "test?.txt\0";
shfo.fFlags |= FOF_FILESONLY;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
- ok(!file_exists("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to not exist\n");
+ ok(!dir_exists("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to not exist\n");
/* try a glob with FOF_MULTIDESTFILES and the same number
* of dest files that we would expect
shfo.fFlags &= ~FOF_FILESONLY;
shfo.fFlags |= FOF_MULTIDESTFILES;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
- ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
+ if (dir_exists("testdir2\\a.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
+ ok(DeleteFile("testdir2\\a.txt\\test2.txt"), "Expected testdir2\\a.txt\\test2.txt to exist\n");
+ ok(DeleteFile("testdir2\\a.txt\\test3.txt"), "Expected testdir2\\a.txt\\test3.txt to exist\n");
+ ok(RemoveDirectory("testdir2\\a.txt\\test4.txt"), "Expected testdir2\\a.txt\\test4.txt to exist\n");
+ RemoveDirectory("testdir2\\a.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(shfo.fAnyOperationsAborted ||
+ broken(!shfo.fAnyOperationsAborted), /* NT4 */
+ "Expected aborted operations\n");
- ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\test1.txt to not exist\n");
+ ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\test1.txt to not exist\n");
+ }
ok(!RemoveDirectory("b.txt"), "b.txt should not exist\n");
/* copy one file to two others, second is ignored */
shfo.pFrom = "test1.txt\0test2.txt\0";
shfo.pTo = "b.txt\0c.txt\0d.txt\0";
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
- ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
+ if (dir_exists("b.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
+ RemoveDirectory("b.txt");
+ ok(DeleteFile("c.txt\\test2.txt"), "Expected c.txt\\test2.txt to exist\n");
+ RemoveDirectory("c.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(shfo.fAnyOperationsAborted ||
+ broken(!shfo.fAnyOperationsAborted), /* NT4 */
+ "Expected aborted operations\n");
- ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
+ ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
+ }
/* copy one file and one directory to three others */
shfo.pFrom = "test1.txt\0test4.txt\0";
shfo.pTo = "b.txt\0c.txt\0d.txt\0";
shfo.fAnyOperationsAborted = FALSE;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
- ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
+ if (dir_exists("b.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
+ RemoveDirectory("b.txt");
+ ok(RemoveDirectory("c.txt\\test4.txt"), "Expected c.txt\\test4.txt to exist\n");
+ RemoveDirectory("c.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(shfo.fAnyOperationsAborted ||
+ broken(!shfo.fAnyOperationsAborted), /* NT4 */
+ "Expected aborted operations\n");
- ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
- ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
+ ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
+ ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
+ }
/* copy a directory with a file beneath it, plus some files */
createTestFile("test4.txt\\a.txt");
shfo.fFlags &= ~FOF_MULTIDESTFILES;
shfo.fAnyOperationsAborted = FALSE;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(DeleteFile("testdir2\\test1.txt"), "Expected newdir\\test1.txt to exist\n");
+ ok(retval == ERROR_SUCCESS ||
+ broken(retval == 0x100a1), /* WinMe */
+ "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (retval == ERROR_SUCCESS)
+ {
+ ok(DeleteFile("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
- ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
- ok(RemoveDirectory("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
+ ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
+ ok(RemoveDirectory("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
+ }
/* copy one directory and a file in that dir to another dir */
shfo.pFrom = "test4.txt\0test4.txt\\a.txt\0";
shfo.pTo = "testdir2\0";
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(retval == ERROR_SUCCESS ||
+ broken(retval == 0x100a1), /* WinMe */
+ "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (retval == ERROR_SUCCESS)
+ {
- ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
- ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
+ ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
+ ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
+ }
/* copy a file in a directory first, and then the directory to a nonexistent dir */
shfo.pFrom = "test4.txt\\a.txt\0test4.txt\0";
shfo.pTo = "nonexistent\0";
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
- ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
+ if (dir_exists("nonexistent"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFile("nonexistent\\test4.txt\\a.txt"), "Expected nonexistent\\test4.txt\\a.txt to exist\n");
+ RemoveDirectory("nonexistent\\test4.txt");
+ ok(DeleteFile("nonexistent\\a.txt"), "Expected nonexistent\\a.txt to exist\n");
+ RemoveDirectory("nonexistent");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+ ok(shfo.fAnyOperationsAborted ||
+ broken(!shfo.fAnyOperationsAborted), /* NT4 */
+ "Expected aborted operations\n");
- ok(!file_exists("nonexistent\\test4.txt"), "Expected nonexistent\\test4.txt to not exist\n");
+ ok(!file_exists("nonexistent\\test4.txt"), "Expected nonexistent\\test4.txt to not exist\n");
+ }
DeleteFile("test4.txt\\a.txt");
/* destination is same as source file */
shfo.fAnyOperationsAborted = FALSE;
shfo.fFlags = FOF_NOERRORUI | FOF_MULTIDESTFILES;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_NO_MORE_SEARCH_HANDLES,
- "Expected ERROR_NO_MORE_SEARCH_HANDLES, got %d\n", retval);
- ok(!shfo.fAnyOperationsAborted, "Expected no operations to be aborted\n");
+ if (retval == DE_OPCANCELLED)
+ {
+ /* NT4 fails and doesn't copy any files */
+ ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
+ }
+ else
+ {
+ ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval);
ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
- ok(!shfo.fAnyOperationsAborted, "Expected no operations to be aborted\n");
+ }
++ ok(!shfo.fAnyOperationsAborted, "Expected no operations to be aborted\n");
ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
/* destination is same as source directory */
shfo.pTo = "test4.txt\\a.txt\0";
shfo.fAnyOperationsAborted = FALSE;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (dir_exists("test4.txt\\a.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_DESTSUBTREE, "Expected DE_DESTSUBTREE, got %d\n", retval);
+ ok(DeleteFile("test4.txt\\a.txt\\test1.txt"), "Expected test4.txt\\a.txt\\test1.txt to exist\n");
+ RemoveDirectory("test4.txt\\a.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(!file_exists("test4.txt\\a.txt"), "Expected test4.txt\\a.txt to not exist\n");
+ ok(!file_exists("test4.txt\\a.txt"), "Expected test4.txt\\a.txt to not exist\n");
+ }
/* copy a nonexistent file to a nonexistent directory */
shfo.pFrom = "e.txt\0";
/* Overwrite tests */
clean_after_shfo_tests();
init_shfo_tests();
- shfo.fFlags = FOF_NOCONFIRMATION;
- shfo.pFrom = "test1.txt\0";
- shfo.pTo = "test2.txt\0";
- shfo.fAnyOperationsAborted = FALSE;
- /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
- retval = SHFileOperation(&shfo);
+ if (!on_nt4)
+ {
+ /* NT4 would throw up some dialog boxes and doesn't copy files that are needed
+ * in subsequent tests.
+ */
- ok(retval == 0, "Expected 0, got %d\n", retval);
+ shfo.fFlags = FOF_NOCONFIRMATION;
+ shfo.pFrom = "test1.txt\0";
+ shfo.pTo = "test2.txt\0";
+ shfo.fAnyOperationsAborted = FALSE;
+ /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
+ retval = SHFileOperation(&shfo);
- ok(file_has_content("test2.txt", "test1.txt\n"), "The file was not copied\n");
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(file_has_content("test2.txt", "test1.txt\n"), "The file was not copied\n");
- shfo.pFrom = "test3.txt\0test1.txt\0";
- shfo.pTo = "test2.txt\0one.txt\0";
- shfo.fFlags = FOF_NOCONFIRMATION | FOF_MULTIDESTFILES;
- /* without FOF_NOCONFIRMATION the confirmation is Yes/Yes to All/No/Cancel */
- retval = SHFileOperation(&shfo);
+ shfo.pFrom = "test3.txt\0test1.txt\0";
+ shfo.pTo = "test2.txt\0one.txt\0";
+ shfo.fFlags = FOF_NOCONFIRMATION | FOF_MULTIDESTFILES;
+ /* without FOF_NOCONFIRMATION the confirmation is Yes/Yes to All/No/Cancel */
+ retval = SHFileOperation(&shfo);
- ok(retval == 0, "Expected 0, got %d\n", retval);
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(file_has_content("test2.txt", "test3.txt\n"), "The file was not copied\n");
+ ok(file_has_content("test2.txt", "test3.txt\n"), "The file was not copied\n");
- shfo.pFrom = "one.txt\0";
- shfo.pTo = "testdir2\0";
- shfo.fFlags = FOF_NOCONFIRMATION;
- /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
- retval = SHFileOperation(&shfo);
- ok(retval == 0, "Expected 0, got %d\n", retval);
- ok(file_has_content("testdir2\\one.txt", "test1.txt\n"), "The file was not copied\n");
+ shfo.pFrom = "one.txt\0";
+ shfo.pTo = "testdir2\0";
+ shfo.fFlags = FOF_NOCONFIRMATION;
+ /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
+ retval = SHFileOperation(&shfo);
+ ok(retval == 0, "Expected 0, got %d\n", retval);
+ ok(file_has_content("testdir2\\one.txt", "test1.txt\n"), "The file was not copied\n");
+ }
createTestFile("test4.txt\\test1.txt");
shfo.pFrom = "test4.txt\0";
shfo.pTo = "testdir2\0";
+ /* WinMe needs FOF_NOERRORUI */
+ shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI;
+ retval = SHFileOperation(&shfo);
+ ok(retval == ERROR_SUCCESS ||
+ broken(retval == 0x100a1), /* WinMe */
+ "Expected ERROR_SUCCESS, got %d\n", retval);
shfo.fFlags = FOF_NOCONFIRMATION;
- ok(!SHFileOperation(&shfo), "First SHFileOperation failed\n");
+ if (ERROR_SUCCESS)
+ {
- createTestFile("test4.txt\\.\\test1.txt"); /* modify the content of the file */
- /* without FOF_NOCONFIRMATION the confirmation is "This folder already contains a folder named ..." */
- retval = SHFileOperation(&shfo);
- ok(retval == 0, "Expected 0, got %d\n", retval);
- ok(file_has_content("testdir2\\test4.txt\\test1.txt", "test4.txt\\.\\test1.txt\n"), "The file was not copied\n");
+ createTestFile("test4.txt\\.\\test1.txt"); /* modify the content of the file */
+ /* without FOF_NOCONFIRMATION the confirmation is "This folder already contains a folder named ..." */
+ retval = SHFileOperation(&shfo);
+ ok(retval == 0, "Expected 0, got %d\n", retval);
+ ok(file_has_content("testdir2\\test4.txt\\test1.txt", "test4.txt\\.\\test1.txt\n"), "The file was not copied\n");
+ }
createTestFile("one.txt");
shfo.pTo = "two.txt\0";
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
- ok(retval == 1148 || retval == 1026, "Expected 1148 or 1026, got %d\n", retval);
+ ok(retval == 1148 || retval == 1026 ||
+ retval == ERROR_ACCESS_DENIED || /* win2k */
+ retval == DE_INVALIDFILES, /* Vista */
+ "Unexpected return value, got %d\n", retval);
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
- ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
+ if (dir_exists("two.txt"))
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(RemoveDirectory("two.txt"), "Expected two.txt to exist\n");
+ else
+ ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
createTestFile("one.txt");
shfo.pTo = to;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (retval == DE_OPCANCELLED)
+ {
+ /* NT4 fails and doesn't copy any files */
+ ok(!file_exists("two.txt"), "Expected two.txt to not exist\n");
+ }
+ else
+ {
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("two.txt"), "Expected file to exist\n");
+ }
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
- ok(DeleteFileA("two.txt"), "Expected file to exist\n");
createTestFile("one.txt");
shfo.pTo = "two.txt\0three.txt\0";
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (retval == DE_OPCANCELLED)
+ {
+ /* NT4 fails and doesn't copy any files */
+ ok(!file_exists("two.txt"), "Expected two.txt to not exist\n");
+ }
+ else
+ {
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("two.txt"), "Expected file to exist\n");
+ }
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
- ok(DeleteFileA("two.txt"), "Expected file to exist\n");
createTestFile("one.txt");
shfo.pTo = to;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
- ok(retval == 1148 || retval == 1026, "Expected 1148 or 1026, got %d\n", retval);
+ ok(retval == 1148 || retval == 1026 ||
+ retval == ERROR_ACCESS_DENIED || /* win2k */
+ retval == DE_INVALIDFILES, /* Vista */
+ "Unexpected return value, got %d\n", retval);
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
- ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
+ if (dir_exists("two.txt"))
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(RemoveDirectory("two.txt"), "Expected two.txt to exist\n");
+ else
+ ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
createTestFile("one.txt");
shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ if (retval == DE_OPCANCELLED)
+ {
+ /* NT4 fails and doesn't copy any files */
+ ok(!file_exists("two.txt"), "Expected two.txt to not exist\n");
+ }
+ else
+ {
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("two.txt"), "Expected file to exist\n");
+ }
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
- ok(DeleteFileA("two.txt"), "Expected file to exist\n");
createTestFile("one.txt");
createTestFile("two.txt");
shfo.pTo = to;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (dir_exists("threedir"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
+ ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
+ ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
- ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
+ ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
+ ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
+ ok(!DeleteFileA("threedir"), "Expected file to not exist\n");
+ ok(!RemoveDirectoryA("threedir"), "Expected dir to not exist\n");
+ }
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
ok(DeleteFileA("two.txt"), "Expected file to exist\n");
- ok(!DeleteFileA("threedir"), "Expected file to not exist\n");
- ok(!RemoveDirectoryA("threedir"), "Expected dir to not exist\n");
createTestFile("one.txt");
createTestFile("two.txt");
ok(DeleteFileA("two.txt"), "Expected file to exist\n");
ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
- createTestFile("one.txt");
- createTestFile("two.txt");
+ if (0) {
+ /* this crashes on win9x */
+ createTestFile("one.txt");
+ createTestFile("two.txt");
- /* no double-NULL terminator for pTo,
+ /* pTo contains bogus 2nd name longer than MAX_PATH,
- * multiple source files, FOF_MULTIDESTFILES
- * dest dir does not exist
- */
+ * multiple source files, FOF_MULTIDESTFILES
+ * dest dir does not exist
+ */
+
- memset(to, 'a', 2 * MAX_PATH);
+ memset(to, 'a', 2 * MAX_PATH);
+ memset(to+MAX_PATH*2, 0, 2);
- lstrcpyA(to, "threedir");
- shfo.pFrom = "one.txt\0two.txt\0";
- shfo.pTo = to;
- shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
- FOF_SILENT | FOF_NOERRORUI;
- retval = SHFileOperation(&shfo);
- ok(retval == ERROR_CANCELLED ||
- retval == ERROR_SUCCESS, /* win2k3 */
- "Expected ERROR_CANCELLED or ERROR_SUCCESS, got %d\n", retval);
- ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
- ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
- ok(DeleteFileA("one.txt"), "Expected file to exist\n");
- ok(DeleteFileA("two.txt"), "Expected file to exist\n");
- ok(!RemoveDirectoryA("threedir"), "Expected dir to not exist\n");
+ lstrcpyA(to, "threedir");
+ shfo.pFrom = "one.txt\0two.txt\0";
+ shfo.pTo = to;
+ shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
+ FOF_SILENT | FOF_NOERRORUI;
+ retval = SHFileOperation(&shfo);
+ ok(retval == ERROR_CANCELLED ||
+ retval == ERROR_SUCCESS, /* win2k3 */
+ "Expected ERROR_CANCELLED or ERROR_SUCCESS, got %d\n", retval);
+ ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
+ ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
+ ok(DeleteFileA("one.txt"), "Expected file to exist\n");
+ ok(DeleteFileA("two.txt"), "Expected file to exist\n");
+ ok(!RemoveDirectoryA("threedir"), "Expected dir to not exist\n");
- /* file exists in win2k */
- DeleteFileA("threedir");
+ /* file exists in win2k */
+ DeleteFileA("threedir");
+ }
+
createTestFile("one.txt");
createTestFile("two.txt");
FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
- ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
ok(DeleteFileA("two.txt"), "Expected file to exist\n");
- ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
+ ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
+ if (dir_exists("fourdir"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
+ ok(DeleteFileA("fourdir\\two.txt"), "Expected file to exist\n");
+ RemoveDirectoryA("fourdir");
+ }
+ else
+ {
- ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
- ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
- ok(!RemoveDirectoryA("fourdir"), "Expected dir to not exist\n");
++ ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
+ ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
+ ok(!RemoveDirectoryA("fourdir"), "Expected dir to not exist\n");
+ }
+ ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
createTestFile("one.txt");
createTestFile("two.txt");
FOF_SILENT | FOF_NOERRORUI;
retval = SHFileOperation(&shfo);
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
- ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
- ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
ok(DeleteFileA("one.txt"), "Expected file to exist\n");
ok(DeleteFileA("two.txt"), "Expected file to exist\n");
- ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
+ ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
+ if (dir_exists("fourdir"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
+ ok(DeleteFileA("fourdir\\two.txt"), "Expected file to exist\n");
+ RemoveDirectoryA("fourdir");
+ }
+ else
+ {
- ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
- ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
- ok(!RemoveDirectoryA("fourdir"), "Expected dit to not exist\n");
++ ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
+ ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
+ ok(!RemoveDirectoryA("fourdir"), "Expected dit to not exist\n");
+ }
+ ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
ok(!DeleteFileA("five"), "Expected file to not exist\n");
ok(!RemoveDirectoryA("five"), "Expected dit to not exist\n");
/* number of sources do not correspond to number of targets */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0");
- ok(SHFileOperationA(&shfo2), "Can't move many files\n");
+ retval = SHFileOperationA(&shfo2);
+ if (dir_exists("test6.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_DESTSAMETREE, "Expected DE_DESTSAMETREE, got %d\n", retval);
+ ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n");
+ RemoveDirectoryA("test6.txt");
+ ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n");
+ RemoveDirectoryA("test7.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(!file_exists("test6.txt"), "The file is not moved - many files are "
- "specified as a target\n");
+ ok(!file_exists("test6.txt"), "The file is not moved - many files are "
+ "specified as a target\n");
+ }
init_shfo_tests();
shfo.pFrom = "test2.txt\0test3.txt\0";
shfo.pTo = "test1.txt\0";
retval = SHFileOperationA(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (dir_exists("test1.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("test1.txt\\test2.txt"), "Expected test1.txt\\test2.txt to exist\n");
+ ok(DeleteFileA("test1.txt\\test3.txt"), "Expected test1.txt\\test3.txt to exist\n");
+ RemoveDirectoryA("test1.txt");
+ createTestFile("test2.txt");
+ createTestFile("test3.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
- ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
- ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
+ ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
+ ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
+ }
/* move a directory into itself */
shfo.pFrom = "test4.txt\0";
shfo.pFrom = "test2.txt\0test3.txt\0";
shfo.pTo = "d.txt\0e.txt\0";
retval = SHFileOperationA(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (dir_exists("d.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+ ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
+ ok(DeleteFileA("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to exist\n");
+ RemoveDirectoryA("d.txt");
+ createTestFile("test2.txt");
+ createTestFile("test3.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
- ok(!DeleteFile("e.txt"), "Expected e.txt to not exist\n");
+ ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
+ ok(!DeleteFile("e.txt"), "Expected e.txt to not exist\n");
+ }
/* number of sources != number of targets */
shfo.pTo = "d.txt\0";
shfo.fFlags |= FOF_MULTIDESTFILES;
retval = SHFileOperationA(&shfo);
- ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
+ if (dir_exists("d.txt"))
+ {
+ /* Vista and W2K8 (broken or new behavior ?) */
+ ok(retval == DE_SAMEFILE,
+ "Expected DE_SAMEFILE, got %d\n", retval);
+ ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
+ ok(!file_exists("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to not exist\n");
+ RemoveDirectoryA("d.txt");
+ createTestFile("test2.txt");
+ }
+ else
+ {
+ expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
- ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
+ ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
+ }
/* FO_MOVE does not create dest directories */
shfo.pFrom = "test2.txt\0";
/* try to overwrite an existing file */
shfo.pTo = "test3.txt\0";
retval = SHFileOperationA(&shfo);
+ if (retval == DE_OPCANCELLED)
+ {
+ /* NT4 fails and doesn't move any files */
+ ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
+ }
+ else
+ {
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!file_exists("test2.txt"), "Expected test2.txt to not exist\n");
- ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
- }
+ ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
+}
+ }
static void test_sh_create_dir(void)
{
if(!pSHCreateDirectoryExA)
{
- trace("skipping SHCreateDirectoryExA tests\n");
+ win_skip("skipping SHCreateDirectoryExA tests\n");
- return;
+ return;
}
set_curr_dir_path(path, "testdir2\\test4.txt\0");
if(!pSHPathPrepareForWriteA)
{
- trace("skipping SHPathPrepareForWriteA tests\n");
+ win_skip("skipping SHPathPrepareForWriteA tests\n");
- return;
+ return;
}
/* directory exists, SHPPFW_NONE */
if (SUCCEEDED(hr)) {
IShellFolder_Release(psfFile);
}
-
+
+ if (!pSHBindToParent)
+ {
+ win_skip("SHBindToParent is missing\n");
+ DeleteFileA(szTestFile);
+ RemoveDirectoryA(szTestDir);
+ return;
+ }
+
/* Some tests for IShellFolder::SetNameOf */
- hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
- ok(SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr);
- if (SUCCEEDED(hr)) {
- /* It's ok to use this fixed path. Call will fail anyway. */
- WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
- LPITEMIDLIST pidlNew;
-
- /* The pidl returned through the last parameter of SetNameOf is a simple one. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
- ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
+ if (pSHGetFolderPathAndSubDirA)
+ {
- ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
- "pidl returned from SetNameOf should be simple!\n");
+ hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
+ ok(SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr);
+ if (SUCCEEDED(hr)) {
+ /* It's ok to use this fixed path. Call will fail anyway. */
+ WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
+ LPITEMIDLIST pidlNew;
+
+ /* The pidl returned through the last parameter of SetNameOf is a simple one. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
+ ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
+ if (hr == S_OK)
+ {
+ ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
+ "pidl returned from SetNameOf should be simple!\n");
- /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
- * is implemented on top of SHFileOperation in WinXP. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
- SHGDN_FORPARSING, NULL);
- ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
+ /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
+ * is implemented on top of SHFileOperation in WinXP. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
+ SHGDN_FORPARSING, NULL);
+ ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
- /* Rename the file back to its original name. SetNameOf ignores the fact, that the
- * SHGDN flags specify an absolute path. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
- ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
+ /* Rename the file back to its original name. SetNameOf ignores the fact, that the
+ * SHGDN flags specify an absolute path. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
+ ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
- pILFree(pidlNew);
+ pILFree(pidlNew);
+ }
+
- IShellFolder_Release(psfPersonal);
- }
+ IShellFolder_Release(psfPersonal);
+ }
+ }
+ else
+ win_skip("Avoid needs of interaction on Win2k\n");
/* Deleting the file and the directory */
DeleteFileA(szTestFile);
len = lstrlenA(cCurrDirA);
if (len == 0) {
- trace("GetCurrentDirectoryA returned empty string. Skipping test_EnumObjects_and_CompareIDs\n");
+ win_skip("GetCurrentDirectoryA returned empty string. Skipping test_GetAttributesOf\n");
- return;
+ return;
}
- if(cCurrDirA[len-1] == '\\')
+ if (len > 3 && cCurrDirA[len-1] == '\\')
- cCurrDirA[len-1] = 0;
+ cCurrDirA[len-1] = 0;
+ /* create test directory */
+ CreateFilesFolders();
+
MultiByteToWideChar(CP_ACP, 0, cCurrDirA, -1, cCurrDirW, MAX_PATH);
hr = SHGetDesktopFolder(&IDesktopFolder);
result = pSHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u\n", GetLastError());
if (!result) return;
-
+
+ /* Check if we are on Win9x */
+ SetLastError(0xdeadbeef);
+ lstrcmpiW(wszDesktop, wszDesktop);
+ if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("Most W-calls are not implemented\n");
+ return;
+ }
+
result = pSHGetPathFromIDListW(pidlEmpty, wszPath);
ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
if (!result) return;
return S_OK;
}
- ok(FALSE, "PropertyBag was asked for unknown property (vt=%d)!\n", V_VT(pVar));
+ if (!lstrcmpW(pszPropName, wszTargetKnownFolder)) {
+ ok(V_VT(pVar) == VT_BSTR, "Wrong variant type for 'TargetKnownFolder' property!\n");
+ /* TODO */
- return E_INVALIDARG;
- }
++ return E_INVALIDARG;
++}
+
+ if (!lstrcmpW(pszPropName, wszCLSID)) {
+ ok(V_VT(pVar) == VT_EMPTY, "Wrong variant type for 'CLSID' property!\n");
+ /* TODO */
+ return E_INVALIDARG;
+ }
+
+ ok(FALSE, "PropertyBag was asked for unknown property %s (vt=%d)!\n", wine_dbgstr_w(pszPropName), V_VT(pVar));
return E_INVALIDARG;
}
static const GUID CLSID_UnixDosFolder =
{0x9d20aae8, 0x0625, 0x44b0, {0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9}};
- if (!pSHGetSpecialFolderPathW || !pStrRetToBufW) return;
+ if (!pSHGetSpecialFolderPathW || !pStrRetToBufW) {
+ win_skip("SHGetSpecialFolderPathW and/or StrRetToBufW are not available\n");
+ return;
+ }
-
+
+ if (!pSHGetFolderPathAndSubDirA)
+ {
+ win_skip("FolderShortcut test doesn't work on Win2k\n");
+ return;
+ }
+
/* These tests basically show, that CLSID_FolderShortcuts are initialized
* via their IPersistPropertyBag interface. And that the target folder
* is taken from the IPropertyBag's 'Target' property.
* this nasty short/long filename stuff. So we'll probably stay with our
* current habbit of storing the long filename here, which seems to work
* just fine. */
- todo_wine { ok(pidlFile->mkid.abID[18] == '~', "Should be derived 8.3 name!\n"); }
+ todo_wine
+ ok(pidlFile->mkid.abID[18] == '~' ||
+ broken(pidlFile->mkid.abID[34] == '~'), /* Win2k */
+ "Should be derived 8.3 name!\n");
if (i == 0) /* First file name has an even number of chars. No need for alignment. */
- ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0',
+ ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0' ||
+ broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1), /* Win2k */
- "Alignment byte, where there shouldn't be!\n");
-
+ "Alignment byte, where there shouldn't be!\n");
+
if (i == 1) /* Second file name has an uneven number of chars => alignment byte */
- ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] == '\0',
+ ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] == '\0',
"There should be an alignment byte, but isn't!\n");
/* The offset of the FileStructW member is stored as a WORD at the end of the pidl. */
nidW.uFlags = NIF_ICON|NIF_MESSAGE;
nidW.hIcon = LoadIcon(NULL, IDI_APPLICATION);
nidW.uCallbackMessage = WM_USER+17;
- ok(pShell_NotifyIconW(NIM_ADD, &nidW), "NIM_ADD failed!\n");
-
+ ret = pShell_NotifyIconW(NIM_ADD, &nidW);
+ if (ret)
+ {
- /* using an invalid cbSize does work */
- nidW.cbSize = 3;
- nidW.hWnd = hMainWnd;
- nidW.uID = 1;
+ /* using an invalid cbSize does work */
+ nidW.cbSize = 3;
+ nidW.hWnd = hMainWnd;
+ nidW.uID = 1;
- ok(pShell_NotifyIconW(NIM_DELETE, &nidW), "NIM_DELETE failed!\n");
+ ret = pShell_NotifyIconW(NIM_DELETE, &nidW);
+ ok( ret || broken(!ret), /* nt4 */ "NIM_DELETE failed!\n");
- /* as icon doesn't exist anymore - now there will be an error */
- nidW.cbSize = sizeof(nidW);
+ /* as icon doesn't exist anymore - now there will be an error */
+ nidW.cbSize = sizeof(nidW);
- ok(!pShell_NotifyIconW(NIM_DELETE, &nidW), "The icon was not deleted\n");
+ ok(!pShell_NotifyIconW(NIM_DELETE, &nidW) != !ret, "The icon was not deleted\n");
- }
++ }
+ else win_skip( "Shell_NotifyIconW not working\n" ); /* win9x */
}
/* same for Shell_NotifyIconA */
const struct test winetest_testlist[] =
{
- { "generated", func_generated },
+ { "appbar", func_appbar },
+ { "autocomplete", func_autocomplete },
+ { "generated", func_generated },
{ "shelllink", func_shelllink },
{ "shellpath", func_shellpath },
{ "shfldr_netplaces", func_shfldr_netplaces },
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_ASSOCF(void)
{
/* invalid arguments */
- stream = NULL;
- ret = (*pSHCreateStreamOnFileW)(NULL, mode | stgm, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
- ret == E_INVALIDARG /* Vista */,
- "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
- ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
+ if (0)
+ {
+ /* Crashes on NT4 */
+ stream = NULL;
+ ret = (*pSHCreateStreamOnFileW)(NULL, mode | stgm, &stream);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
+ ret == E_INVALIDARG /* Vista */,
+ "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
+ ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
+ }
- #if 0 /* This test crashes on WinXP SP2 */
+ if (0)
+ {
+ /* This test crashes on WinXP SP2 */
- ret = (*pSHCreateStreamOnFileW)(test_file, mode | stgm, NULL);
- ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
+ ret = (*pSHCreateStreamOnFileW)(test_file, mode | stgm, NULL);
+ ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
- #endif
+ }
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_CONVERT | stgm, &stream);
/* invalid arguments */
- stream = NULL;
- ret = (*pSHCreateStreamOnFileEx)(NULL, mode, 0, FALSE, NULL, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
- ret == E_INVALIDARG /* Vista */,
- "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
- ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
+ if (0)
+ {
+ /* Crashes on NT4 */
+ stream = NULL;
+ ret = (*pSHCreateStreamOnFileEx)(NULL, mode, 0, FALSE, NULL, &stream);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
+ ret == E_INVALIDARG /* Vista */,
+ "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
+ ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
+ }
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, template, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
+ ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
+ ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
+ "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
+ "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
+
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
- #if 0 /* This test crashes on WinXP SP2 */
+ if (0)
+ {
+ /* This test crashes on WinXP SP2 */
- ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, NULL, NULL);
- ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08x\n", ret);
+ ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, NULL, NULL);
+ ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08x\n", ret);
- #endif
+ }
/* file does not exist */
for (c = 0x007f; c <= 0xffff; c++)
{
ret = pPathIsValidCharW( c, ~0U );
- ok ( ret == 0x00000100,
- "PathIsValidCharW failed: 0x%02x got 0x%08x expected 0x00000100\n",
- c, (DWORD)ret );
- if (ret != 0x00000100)
- {
- if(++err_count > 100 ) {
- trace("skipping rest of PathIsValidCharW tests "
- "because of the current number of errors\n");
- break;
+ ok ( ret, "PathIsValidCharW failed: 0x%02x got 0x%08x\n", c, ret );
- }
-}
+ }
+ }
- }
- }
static void test_PathMakePretty(void)
{
todo_wine
{
- ok( (0 == strcmp("", buf)) || (0 == strcmp(sEnvvar2, buf)),
+ ok( (0 == strcmp("", buf)) || (0 == strcmp(sEnvvar2, buf)) ||
+ broken(0 == strcmp(sTestpath2, buf)), /* IE 5.5 */
- "Expected empty or first part of the string \"%s\", got \"%s\"\n", sEnvvar2, buf);
+ "Expected empty or first part of the string \"%s\", got \"%s\"\n", sEnvvar2, buf);
}
- ok( dwSize >= nUsedBuffer2, "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
+ ok( dwSize >= nUsedBuffer2 ||
+ broken(dwSize == (strlen(sEnvvar2) + 1)) || /* IE4.01 SP1 (W98) and IE5 (W98SE) */
+ broken(dwSize == (strlen("") + 1)), /* IE4.01 (NT4) and IE5.x (W2K) */
+ "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
/*
return;
}
-
- if (pSHCopyKeyA)
- {
- dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
- ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
+ dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
+ ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
- }
RegCloseKey(hKeySrc);
RegCloseKey(hKeyDst);
ret = pStrRetToBSTR(&strret, NULL, &bstr);
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
"STRRET_WSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
- if (bstr)
- SysFreeString(bstr);
+ SysFreeString(bstr);
strret.uType = STRRET_CSTR;
lstrcpyA(U(strret).cStr, "Test");
ret = pStrRetToBSTR(&strret, NULL, &bstr);
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
"STRRET_CSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
- if (bstr)
- SysFreeString(bstr);
+ SysFreeString(bstr);
strret.uType = STRRET_OFFSET;
U(strret).uOffset = 1;
ret = pStrRetToBSTR(&strret, iidl, &bstr);
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
"STRRET_OFFSET: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
- if (bstr)
- SysFreeString(bstr);
+ SysFreeString(bstr);
/* Native crashes if str is NULL */
}
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_BINDINFO(void)
{
ok(size > 0, "size=%d, expected non-zero\n", size);
str2 = HeapAlloc(GetProcessHeap(), 0, (size+20)*sizeof(CHAR));
- if (!str2)
- {
- skip("skipping rest of ObtainUserAgent tests, out of memory\n");
- }
- else
- {
- saved = size;
- hres = ObtainUserAgentString(0, str2, &size);
- ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
- ok(size == saved, "size=%d, expected %d\n", size, saved);
- ok(strlen(expected) <= strlen(str2) &&
- !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
- "user agent was \"%s\", expected to start with \"%s\"\n",
- str2, expected);
-
- size = saved+10;
- hres = ObtainUserAgentString(0, str2, &size);
- ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
- ok(size == saved, "size=%d, expected %d\n", size, saved);
+ saved = size;
+ hres = ObtainUserAgentString(0, str2, &size);
+ ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
+ ok(size == saved, "size=%d, expected %d\n", size, saved);
+ ok(strlen(expected) <= strlen(str2) &&
+ !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
+ "user agent was \"%s\", expected to start with \"%s\"\n",
+ str2, expected);
+
+ size = saved+10;
+ hres = ObtainUserAgentString(0, str2, &size);
+ ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
+ ok(size == saved, "size=%d, expected %d\n", size, saved);
- }
+
+ size = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size, "size == 0\n");
+
+ size = 0xdeadbeef;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 1000, &size, 0);
+ ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size, "size == 0\n");
+
+ saved = size;
+ size = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved+10, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == saved, "size = %d, expected %d\n", size, saved);
+ ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
+ "user agent was \"%s\", expected to start with \"%s\"\n",
+ str2, expected);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == saved, "size = %d, expected %d\n", size, saved);
+ ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
+ "user agent was \"%s\", expected to start with \"%s\"\n",
+ str2, expected);
+
+ size = saved;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved-1, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == saved, "size = %d, expected %d\n", size, saved);
+ ok(!str2[0], "buf changed\n");
+
+ size = saved;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, NULL, 0);
+ ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(!str2[0], "buf changed\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, sizeof(test_str), 0);
+ ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test2_str, sizeof(test2_str), 0);
+ ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 2, 0);
+ ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == 3 && !strcmp(str2, "te"), "wrong user agent\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 0, 0);
+ ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, sizeof(test_str), 0);
+ ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, 0);
+ ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+
HeapFree(GetProcessHeap(), 0, str2);
}
{
HRESULT hres;
- CHECK_EXPECT(Switch);
- ok(pProtocolData != NULL, "pProtocolData == NULL\n");
-
- pdata = pProtocolData;
-
- if(binding_test) {
- SetEvent(event_complete);
- WaitForSingleObject(event_complete2, INFINITE);
- return S_OK;
- }
-
- if(!state) {
+ if (!state) {
+ if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST)
+ CLEAR_CALLED(ReportProgress_COOKIE_SENT);
+ if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST || tested_protocol == FTP_TEST) {
- if (http_is_first) {
+ if (http_is_first) {
- CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
- CHECK_CALLED(ReportProgress_CONNECTING);
+ CLEAR_CALLED(ReportProgress_FINDINGRESOURCE);
+ CLEAR_CALLED(ReportProgress_CONNECTING);
+ CLEAR_CALLED(ReportProgress_PROXYDETECTING);
- } else todo_wine {
- CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE);
+ } else todo_wine {
+ CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE);
- CHECK_NOT_CALLED(ReportProgress_CONNECTING);
+ /* IE7 does call this */
+ CLEAR_CALLED(ReportProgress_CONNECTING);
- }
+ }
+ }
+ if(tested_protocol == FTP_TEST)
+ todo_wine CHECK_CALLED(ReportProgress_SENDINGREQUEST);
+ else if (tested_protocol != HTTPS_TEST)
- CHECK_CALLED(ReportProgress_SENDINGREQUEST);
+ CHECK_CALLED(ReportProgress_SENDINGREQUEST);
+ if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) {
- SET_EXPECT(OnResponse);
+ SET_EXPECT(OnResponse);
+ if(tested_protocol == HTTPS_TEST)
+ SET_EXPECT(ReportProgress_ACCEPTRANGES);
- SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
- if(bindf & BINDF_NEEDFILE)
- SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
- }
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ if(bindf & BINDF_NEEDFILE)
+ SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
+ }
+ }
SET_EXPECT(ReportData);
- hres = IInternetProtocol_Continue(http_protocol, pProtocolData);
+ hres = IInternetProtocol_Continue(async_protocol, protocol_data);
ok(hres == S_OK, "Continue failed: %08x\n", hres);
- CHECK_CALLED(ReportData);
+ if(tested_protocol == FTP_TEST)
+ CLEAR_CALLED(ReportData);
+ else if (! security_problem)
+ CHECK_CALLED(ReportData);
if (!state) {
- state = 1;
+ if (! security_problem)
+ {
- CHECK_CALLED(OnResponse);
+ state = 1;
+ if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) {
- CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
- if(bindf & BINDF_NEEDFILE)
- CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
- }
+ CHECK_CALLED(OnResponse);
+ if(tested_protocol == HTTPS_TEST)
+ CHECK_CALLED(ReportProgress_ACCEPTRANGES);
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ if(bindf & BINDF_NEEDFILE)
+ CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
+ }
+ }
+ else
+ {
+ security_problem = FALSE;
+ SET_EXPECT(ReportProgress_CONNECTING);
+ }
+ }
+ }
+
+ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
+ {
+ if(tested_protocol == FTP_TEST)
+ CHECK_EXPECT2(Switch);
+ else
+ CHECK_EXPECT(Switch);
+
+ ok(pProtocolData != NULL, "pProtocolData == NULL\n");
+ if(binding_test) {
+ ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
+ ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %x/%x\n",
+ pProtocolData->grfFlags, protocoldata.grfFlags );
+ ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\n",
+ pProtocolData->dwState, protocoldata.dwState );
+ ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
+ pProtocolData->pData, protocoldata.pData );
+ ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %x/%x\n",
+ pProtocolData->cbData, protocoldata.cbData );
+ }
+
+ pdata = pProtocolData;
- SetEvent(event_complete);
+ if(binding_test) {
+ SetEvent(event_complete);
+ WaitForSingleObject(event_complete2, INFINITE);
+ return S_OK;
+ }if(direct_read) {
+ continue_protdata = *pProtocolData;
+ SetEvent(event_continue);
+ WaitForSingleObject(event_continue_done, INFINITE);
+ }else {
+ call_continue(pProtocolData);
+ SetEvent(event_complete);
+ }
return S_OK;
}
CHECK_EXPECT(ReportData);
- if(tested_protocol == BIND_TEST)
- return S_OK;
-
+ if(tested_protocol != BIND_TEST) {
- do {
+ do {
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Read);
+ else if(rec_depth > 1)
+ SET_EXPECT(Read2);
+ else
- SET_EXPECT(Read);
- hres = IInternetProtocol_Read(binding_protocol, expect_pv=buf, sizeof(buf), &read);
+ SET_EXPECT(Read);
+ hres = IInternetProtocol_Read(binding_protocol, expect_pv=buf, sizeof(buf), &read);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Read);
+ else if(rec_depth > 1)
+ CHECK_CALLED(Read2);
+ else
- CHECK_CALLED(Read);
- }while(hres == S_OK);
- }
+ CHECK_CALLED(Read);
+ }while(hres == S_OK);
+ }
+ }
+ rec_depth--;
return S_OK;
}
{
CHECK_EXPECT(ReportResult);
- ok(hrResult == expect_hrResult, "hrResult = %08x, expected: %08x\n",
- hrResult, expect_hrResult);
+ if(tested_protocol == FTP_TEST)
+ ok(hrResult == E_PENDING || hrResult == S_OK, "hrResult = %08x, expected E_PENDING or S_OK\n", hrResult);
+ else
- if(SUCCEEDED(hrResult))
+ ok(hrResult == expect_hrResult, "hrResult = %08x, expected: %08x\n",
+ hrResult, expect_hrResult);
+ if(SUCCEEDED(hrResult) || tested_protocol == FTP_TEST)
ok(dwError == ERROR_SUCCESS, "dwError = %d, expected ERROR_SUCCESS\n", dwError);
else
- ok(dwError != ERROR_SUCCESS, "dwError == ERROR_SUCCESS\n");
+ ok(dwError != ERROR_SUCCESS ||
+ broken(tested_protocol == MK_TEST), /* Win9x, WinME and NT4 */
+ "dwError == ERROR_SUCCESS\n");
ok(!szResult, "szResult != NULL\n");
+ if(direct_read)
+ SET_EXPECT(ReportData); /* checked after main loop */
+
return S_OK;
}
return S_OK;
}
- ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+ if(IsEqualGUID(&IID_IWinInetInfo, riid)) {
+ CHECK_EXPECT(QueryInterface_IWinInetInfo);
- *ppv = NULL;
- return E_NOINTERFACE;
- }
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
- static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
- {
- return 2;
+ if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
+ CHECK_EXPECT(QueryInterface_IWinInetHttpInfo);
+ *ppv = NULL;
+ return E_NOINTERFACE;
- }
+}
- static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
- {
- return 1;
+ ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+ *ppv = NULL;
+ return E_NOINTERFACE;
}
static DWORD WINAPI thread_proc(PVOID arg)
CHECK_CALLED(Switch);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
- prot_state = 2;
+ if(!short_read) {
- SET_EXPECT(Switch);
- hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ prot_state = 2;
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Switch);
+ else
- CHECK_CALLED(Switch);
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Switch);
+ else
- ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ CHECK_CALLED(Switch);
- prot_state = 2;
+ prot_state = 2;
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Switch);
+ else
- SET_EXPECT(Switch);
- hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Switch);
+ else
- CHECK_CALLED(Switch);
+ CHECK_CALLED(Switch);
- ok(hres == S_OK, "Switch failed: %08x\n", hres);
- prot_state = 3;
+ prot_state = 3;
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Switch);
+ else
- SET_EXPECT(Switch);
- hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Switch);
+ else
- CHECK_CALLED(Switch);
+ CHECK_CALLED(Switch);
- ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ }
SetEvent(event_complete);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_CreateInstance);
+ SET_EXPECT(MimeFilter_Start);
+ SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
+ }
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
- expect_wsz = text_htmlW);
+ mimefilter_test ? gzipW : (expect_wsz = text_htmlW));
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
- CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ if(mimefilter_test) {
+ CHECK_CALLED(MimeFilter_CreateInstance);
+ CHECK_CALLED(MimeFilter_Start);
+ CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
+ todo_wine CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }else {
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }
- SET_EXPECT(ReportData);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportData);
+ else
+ SET_EXPECT(ReportData);
hres = IInternetProtocolSink_ReportData(pOIProtSink,
BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
- CHECK_CALLED(ReportData);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportData);
+ else
+ CHECK_CALLED(ReportData);
if(tested_protocol == BIND_TEST) {
hres = IInternetProtocol_Terminate(binding_protocol, 0);
ok(hres == E_FAIL, "Termiante failed: %08x\n", hres);
}
- SET_EXPECT(ReportResult);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportResult);
+ else
+ SET_EXPECT(ReportResult);
hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
- CHECK_CALLED(ReportResult);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportResult);
+ else
+ CHECK_CALLED(ReportResult);
return S_OK;
}
IHttpNegotiate_Release(http_negotiate);
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
- SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_CreateInstance);
+ SET_EXPECT(MimeFilter_Start);
+ SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
+ }else if(!(pi & PI_MIMEVERIFICATION)) {
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ }
hres = IInternetProtocolSink_ReportProgress(binding_sink,
- BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW);
+ BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? gzipW : text_htmlW);
+ if(mimefilter_test) {
+ CHECK_CALLED(MimeFilter_CreateInstance);
+ CHECK_CALLED(MimeFilter_Start);
+ CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
+ }else if(!(pi & PI_MIMEVERIFICATION)) {
- CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
break;
}
- SET_EXPECT(ReportData);
+ pr = prot_read;
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_ReportData);
+ }else if(pi & PI_MIMEVERIFICATION) {
+ if(pr < 200)
+ SET_EXPECT(Read); /* checked in ReportData for short_read */
+ if(pr == 200) {
+ if(!mimefilter_test)
+ SET_EXPECT(Read); /* checked in BINDSTATUS_MIMETYPEAVAILABLE or ReportData */
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ }
+ if(pr >= 200)
- hres = IInternetProtocolSink_ReportData(binding_sink, bscf, 100, 400);
- CHECK_CALLED(ReportData);
+ SET_EXPECT(ReportData);
+ }else {
+ SET_EXPECT(ReportData);
+ }
+
+ hres = IInternetProtocolSink_ReportData(binding_sink, bscf, pr, 400);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_ReportData);
+ }else if(pi & PI_MIMEVERIFICATION) {
+ if(!short_read && pr < 200)
+ CHECK_CALLED(Read);
+ if(pr == 200) {
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }
+ }else {
+ CHECK_CALLED(ReportData);
+ }
+
if(prot_state == 3)
prot_state = 4;
return S_OK;
}
- static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
- {
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
- }
-
- static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
- {
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
- }
-
- static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
+ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocol *iface, void *pv,
ULONG cb, ULONG *pcbRead)
{
- static BOOL b = TRUE;
-
+ if(read_report_data)
+ CHECK_EXPECT2(Read2);
+
+ if(mimefilter_test || short_read) {
+ if(!read_report_data)
+ CHECK_EXPECT2(Read);
+ }else if((pi & PI_MIMEVERIFICATION)) {
+ if(!read_report_data)
+ CHECK_EXPECT2(Read);
+
+ if(prot_read < 300) {
+ ok(pv != expect_pv, "pv == expect_pv\n");
+ if(prot_read < 300)
+ ok(cb == 2048-prot_read, "cb=%d\n", cb);
+ else
+ ok(cb == 700, "cb=%d\n", cb);
+ }else {
+ ok(expect_pv <= pv && (BYTE*)pv < (BYTE*)expect_pv + cb, "pv != expect_pv\n");
- }
++}
+ }else {
+ if(!read_report_data)
- CHECK_EXPECT(Read);
+ CHECK_EXPECT(Read);
- ok(pv == expect_pv, "pv != expect_pv\n");
- ok(cb == 1000, "cb=%d\n", cb);
+ ok(pv == expect_pv, "pv != expect_pv\n");
+ ok(cb == 1000, "cb=%d\n", cb);
+ ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
+ }
ok(pcbRead != NULL, "pcbRead == NULL\n");
- ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
- if(prot_state == 3) {
+ if(prot_state == 3 || (short_read && prot_state != 4)) {
HRESULT hres;
- SET_EXPECT(ReportResult);
+ prot_state = 4;
+ if(short_read) {
+ SET_EXPECT(Read2); /* checked in BINDSTATUS_MIMETYPEAVAILABLE */
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ }
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportData);
+ else if(direct_read)
+ SET_EXPECT(ReportData2);
+ read_report_data++;
+ hres = IInternetProtocolSink_ReportData(binding_sink,
+ BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 0, 0);
+ read_report_data--;
+ ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+ if(short_read)
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportData);
+ else if(direct_read)
+ CHECK_CALLED(ReportData2);
+
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportResult);
+ else
+ SET_EXPECT(ReportResult);
hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
- CHECK_CALLED(ReportResult);
+ ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportResult);
+ else
+ CHECK_CALLED(ReportResult);
+ memset(pv, 'x', 100);
+ prot_read += *pcbRead = 100;
+ return S_OK;
+ }if(prot_state == 4) {
+ *pcbRead = 0;
return S_FALSE;
}
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) {
- file_protocol_start(protocol, url, TRUE);
+ if(file_protocol_start(protocol, url, TRUE)) {
- hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
- ok(hres == S_OK, "Read failed: %08x\n", hres);
- ok(cb == 2, "cb=%u expected 2\n", cb);
- hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
- ok(hres == S_FALSE, "Read failed: %08x\n", hres);
- hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
- ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
- ok(cb == 0, "cb=%u expected 0\n", cb);
- hres = IInternetProtocol_UnlockRequest(protocol);
- ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+ hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
+ ok(hres == S_OK, "Read failed: %08x\n", hres);
+ ok(cb == 2, "cb=%u expected 2\n", cb);
+ hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
+ ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+ hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
+ ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
+ ok(cb == 0, "cb=%u expected 0\n", cb);
+ hres = IInternetProtocol_UnlockRequest(protocol);
+ ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+ }
- file_protocol_start(protocol, url, FALSE);
+ if(file_protocol_start(protocol, url, FALSE)) {
- hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
- ok(hres == S_FALSE, "Read failed: %08x\n", hres);
- hres = IInternetProtocol_LockRequest(protocol, 0);
- ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
- hres = IInternetProtocol_UnlockRequest(protocol);
- ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+ hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
+ ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+ hres = IInternetProtocol_LockRequest(protocol, 0);
+ ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+ hres = IInternetProtocol_UnlockRequest(protocol);
+ ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+ }
IInternetProtocol_Release(protocol);
}
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) {
- file_protocol_start(protocol, url, TRUE);
+ if(file_protocol_start(protocol, url, TRUE)) {
- hres = IInternetProtocol_LockRequest(protocol, 0);
- ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
- hres = IInternetProtocol_Terminate(protocol, 0);
- ok(hres == S_OK, "Terminate failed: %08x\n", hres);
- hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
- ok(hres == S_OK, "Read failed: %08x\n\n", hres);
- hres = IInternetProtocol_UnlockRequest(protocol);
- ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
- hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
- ok(hres == S_OK, "Read failed: %08x\n", hres);
- hres = IInternetProtocol_Terminate(protocol, 0);
- ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+ hres = IInternetProtocol_LockRequest(protocol, 0);
+ ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+ hres = IInternetProtocol_Terminate(protocol, 0);
+ ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+ hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
+ ok(hres == S_OK, "Read failed: %08x\n\n", hres);
+ hres = IInternetProtocol_UnlockRequest(protocol);
+ ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+ hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
+ ok(hres == S_OK, "Read failed: %08x\n", hres);
+ hres = IInternetProtocol_Terminate(protocol, 0);
+ ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+ }
IInternetProtocol_Release(protocol);
}
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) {
- file_protocol_start(protocol, url, TRUE);
+ if(file_protocol_start(protocol, url, TRUE)) {
- hres = IInternetProtocol_Terminate(protocol, 0);
- ok(hres == S_OK, "Terminate failed: %08x\n", hres);
- hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
- ok(hres == S_OK, "Read failed: %08x\n", hres);
- ok(cb == 2, "cb=%u expected 2\n", cb);
+ hres = IInternetProtocol_Terminate(protocol, 0);
+ ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+ hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
+ ok(hres == S_OK, "Read failed: %08x\n", hres);
+ ok(cb == 2, "cb=%u expected 2\n", cb);
+ }
IInternetProtocol_Release(protocol);
}
SET_EXPECT(GetBindInfo);
if (!(bindf & BINDF_FROMURLMON))
SET_EXPECT(ReportProgress_DIRECTBIND);
- SET_EXPECT(GetBindString_USER_AGENT);
+ if(!got_user_agent)
+ SET_EXPECT(GetBindString_USER_AGENT);
SET_EXPECT(GetBindString_ACCEPT_MIMES);
SET_EXPECT(QueryService_HttpNegotiate);
SET_EXPECT(BeginningTransaction);
SET_EXPECT(Switch);
}
- if(!http_protocol_start(url, is_first))
+ if(!http_protocol_start(url))
return;
- SET_EXPECT(ReportResult);
+ if(!direct_read)
+ SET_EXPECT(ReportResult);
expect_hrResult = S_OK;
- hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
- ok((!*called && hres == E_PENDING && cb==0) ||
- (*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+ if(direct_read) {
+ while(wait_for_switch) {
+ SET_EXPECT(Switch);
+ WaitForSingleObject(event_continue, INFINITE);
+ CHECK_CALLED(Switch);
+ call_continue(&continue_protdata);
+ SetEvent(event_continue_done);
+ }
+ }else {
+ hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
+ ok((hres == E_PENDING && cb==0) ||
+ (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
- WaitForSingleObject(event_complete, INFINITE);
- if(bindf & BINDF_FROMURLMON)
- CHECK_CALLED(Switch);
- else
- CHECK_CALLED(ReportData);
+ WaitForSingleObject(event_complete, INFINITE);
+ if(bindf & BINDF_FROMURLMON)
+ CHECK_CALLED(Switch);
+ else
+ CHECK_CALLED(ReportData);
+ if(prot == HTTPS_TEST)
+ CLEAR_CALLED(QueryService_HttpSecurity);
- while(1) {
- if(bindf & BINDF_FROMURLMON)
- SET_EXPECT(Switch);
- else
- SET_EXPECT(ReportData);
+ while(1) {
+ if(bindf & BINDF_FROMURLMON)
+ SET_EXPECT(Switch);
+ else
+ SET_EXPECT(ReportData);
- hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb);
+ hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
- if(hres == E_PENDING) {
+ if(hres == E_PENDING) {
- hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
- ok((!*called && hres == E_PENDING && cb==0) ||
- (*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+ hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
+ ok((hres == E_PENDING && cb==0) ||
+ (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
- WaitForSingleObject(event_complete, INFINITE);
- if(bindf & BINDF_FROMURLMON)
- CHECK_CALLED(Switch);
- else
- CHECK_CALLED(ReportData);
- }else {
- if(bindf & BINDF_FROMURLMON)
- CHECK_NOT_CALLED(Switch);
- else
- CHECK_NOT_CALLED(ReportData);
- if(cb == 0) break;
- }
+ WaitForSingleObject(event_complete, INFINITE);
+ if(bindf & BINDF_FROMURLMON)
+ CHECK_CALLED(Switch);
+ else
+ CHECK_CALLED(ReportData);
+ } else {
+ if(bindf & BINDF_FROMURLMON)
+ CHECK_NOT_CALLED(Switch);
+ else
+ CHECK_NOT_CALLED(ReportData);
+ if(cb == 0) break;
}
- ok(hres == S_FALSE, "Read failed: %08x\n", hres);
- CHECK_CALLED(ReportResult);
+ }
+ ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+ CHECK_CALLED(ReportResult);
+ }
+ if(prot == HTTPS_TEST)
+ CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
- hres = IInternetProtocol_LockRequest(http_protocol, 0);
- ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
-
- hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
- ok(hres == S_FALSE, "Read failed: %08x\n", hres);
-
- hres = IInternetProtocol_Terminate(http_protocol, 0);
- ok(hres == S_OK, "Terminate failed: %08x\n", hres);
-
- /* This wait is to give the internet handles being freed in Terminate
- * enough time to actually terminate in all cases. Internet handles
- * terminate asynchronously and native reuses the main InternetOpen
- * handle. The only case in which this seems to be necessary is on
- * wine with native wininet and urlmon, resulting in the next time
- * test_http_protocol_url being called the first data notification actually
- * being an extra last data notification from the previous connection
- * about once out of every ten times. */
- Sleep(100);
-
- hres = IInternetProtocol_UnlockRequest(http_protocol);
- ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
-
- IInternetProtocol_Release(http_protocol);
+ test_protocol_terminate(async_protocol);
+ ref = IInternetProtocol_Release(async_protocol);
+ ok(!ref, "ref=%x\n", hres);
}
IClassFactory_Release(factory);
hres = CoInternetGetSession(0, &session, 0);
ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
- hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
- ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+ if(test_flags & TEST_EMULATEPROT) {
+ hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
+ ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+ }
hres = IInternetSession_CreateBinding(session, NULL, binding_urls[prot], NULL, NULL, &protocol, 0);
binding_protocol = protocol;
CHECK_CALLED(SetPriority);
CHECK_CALLED(Start);
- if(prot == HTTP_TEST) {
+ if(prot == HTTP_TEST || prot == HTTPS_TEST) {
while(prot_state < 4) {
WaitForSingleObject(event_complete, INFINITE);
- SET_EXPECT(Continue);
+ if(mimefilter_test && filtered_protocol) {
- IInternetProtocol_Continue(protocol, pdata);
- CHECK_CALLED(Continue);
+ SET_EXPECT(Continue);
+ IInternetProtocol_Continue(filtered_protocol, pdata);
+ CHECK_CALLED(Continue);
+ }else {
+ SET_EXPECT(Continue);
+ IInternetProtocol_Continue(protocol, pdata);
+ CHECK_CALLED(Continue);
+ }
SetEvent(event_complete2);
}
-
+ if(direct_read)
+ CHECK_CALLED(ReportData); /* Set in ReportResult */
WaitForSingleObject(event_complete, INFINITE);
}else {
- SET_EXPECT(LockRequest);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_LockRequest);
+ else
+ SET_EXPECT(LockRequest);
hres = IInternetProtocol_LockRequest(protocol, 0);
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
- CHECK_CALLED(LockRequest);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_LockRequest);
+ else
+ CHECK_CALLED(LockRequest);
- SET_EXPECT(UnlockRequest);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_UnlockRequest);
+ else
+ SET_EXPECT(UnlockRequest);
hres = IInternetProtocol_UnlockRequest(protocol);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
- CHECK_CALLED(UnlockRequest);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_UnlockRequest);
+ else
+ CHECK_CALLED(UnlockRequest);
}
- SET_EXPECT(Terminate);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Terminate);
+ else
+ SET_EXPECT(Terminate);
hres = IInternetProtocol_Terminate(protocol, 0);
ok(hres == S_OK, "Terminate failed: %08x\n", hres);
- CHECK_CALLED(Terminate);
+ if(mimefilter_test)
+ CLEAR_CALLED(MimeFilter_Terminate);
+ else
+ CHECK_CALLED(Terminate);
+ if(filtered_protocol)
+ IInternetProtocol_Release(filtered_protocol);
IInternetBindInfo_Release(prot_bind_info);
IInternetProtocolSink_Release(binding_sink);
ref = IInternetProtocol_Release(protocol);
ok(!ref, "ref=%u, expected 0\n", ref);
- }
+
+ if(test_flags & TEST_EMULATEPROT) {
+ hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, protocol_names[prot]);
+ ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
++}
+
+ IInternetSession_Release(session);
+ }
+
+ static void register_filter(void)
+ {
+ IInternetSession *session;
+ HRESULT hres;
+
+ static const WCHAR gzipW[] = {'g','z','i','p',0};
+
+ CoInternetGetSession(0, &session, 0);
+
+ hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gzipW);
+ ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+
+ IInternetSession_Release(session);
}
START_TEST(protocol)
const struct test winetest_testlist[] =
{
- { "generated", func_generated },
- { "misc", func_misc },
- { "protocol", func_protocol },
+ { "generated", func_generated },
+ { "misc", func_misc },
+ { "protocol", func_protocol },
+ { "sec_mgr", func_sec_mgr },
- { "stream", func_stream },
- { "url", func_url },
+ { "stream", func_stream },
+ { "url", func_url },
{ 0, 0 }
};
return S_OK;
}
- *ppv = NULL;
+ if(IsEqualGUID(&IID_IInternetPriority, riid)) {
+ if(!is_urlmon_protocol(test_protocol))
- return E_NOINTERFACE;
++ return E_NOINTERFACE;
+
+ *ppv = &InternetPriority;
+ return S_OK;
- }
++}
+
+ if(IsEqualGUID(&IID_IInternetProtocolEx, riid))
+ return E_NOINTERFACE; /* TODO */
+
+ ok(0, "unexpected call %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
CHECK_CALLED(Start);
CHECK_CALLED(UnlockRequest);
}else {
- if(test_protocol == HTTP_TEST) {
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
CHECK_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction);
- CHECK_CALLED(QueryInterface_IHttpNegotiate2);
- CHECK_CALLED(GetRootSecurityId);
- }
+ if (have_IHttpNegotiate2)
+ {
- if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST)
+ CHECK_CALLED(QueryInterface_IHttpNegotiate2);
+ CHECK_CALLED(GetRootSecurityId);
+ }
+ CLEAR_CALLED(QueryInterface_IWindowForBindingUI);
+ }
+ if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_SENDINGREQUEST);
- if(test_protocol == HTTP_TEST)
+ else if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ CLEAR_CALLED(OnProgress_SENDINGREQUEST); /* not called by IE7 */
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(OnResponse);
+ }
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
create_file();
test_create();
+
+ trace("test CreateAsyncBindCtx...\n");
test_CreateAsyncBindCtx();
+
+ trace("test CreateAsyncBindCtxEx...\n");
test_CreateAsyncBindCtxEx();
- test_RegisterBindStatusCallback();
+
+ trace("test RegisterBindStatusCallback...\n");
+ if(test_RegisterBindStatusCallback()) {
+ trace("test BindToStorage failures...\n");
- test_BindToStorage_fail();
+ test_BindToStorage_fail();
- trace("synchronous http test (COM not initialised)...\n");
- test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
+ trace("synchronous http test (COM not initialised)...\n");
+ test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
- CoInitialize(NULL);
+ CoInitialize(NULL);
- trace("synchronous http test...\n");
- test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
+ trace("test StdURLMoniker...\n");
+ test_StdURLMoniker();
+
+ trace("synchronous http test...\n");
+ test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
- trace("synchronous http test (to object)...\n");
- test_BindToObject(HTTP_TEST, FALSE);
+ trace("synchronous http test (to object)...\n");
+ test_BindToObject(HTTP_TEST, FALSE);
- trace("synchronous file test...\n");
- test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
+ trace("synchronous file test...\n");
+ test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
- trace("synchronous file test (to object)...\n");
- test_BindToObject(FILE_TEST, FALSE);
+ trace("synchronous file test (to object)...\n");
+ test_BindToObject(FILE_TEST, FALSE);
- bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
+ bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
- trace("http test...\n");
- test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
+ trace("http test...\n");
+ test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
- trace("http test (to file)...\n");
- test_BindToStorage(HTTP_TEST, FALSE, TYMED_FILE);
+ trace("http test (to file)...\n");
+ test_BindToStorage(HTTP_TEST, FALSE, TYMED_FILE);
- trace("http test (to object)...\n");
- test_BindToObject(HTTP_TEST, FALSE);
+ trace("http test (to object)...\n");
+ test_BindToObject(HTTP_TEST, FALSE);
- trace("http test (short response)...\n");
- http_is_first = TRUE;
- urls[HTTP_TEST] = SHORT_RESPONSE_URL;
- test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
+ trace("http test (short response)...\n");
+ http_is_first = TRUE;
+ urls[HTTP_TEST] = SHORT_RESPONSE_URL;
+ test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
- trace("http test (short response, to object)...\n");
- test_BindToObject(HTTP_TEST, FALSE);
+ trace("http test (short response, to object)...\n");
+ test_BindToObject(HTTP_TEST, FALSE);
- trace("emulated http test...\n");
- test_BindToStorage(HTTP_TEST, TRUE, TYMED_ISTREAM);
+ trace("emulated http test...\n");
+ test_BindToStorage(HTTP_TEST, TRUE, TYMED_ISTREAM);
- trace("emulated http test (to object)...\n");
- test_BindToObject(HTTP_TEST, TRUE);
+ trace("emulated http test (to object)...\n");
+ test_BindToObject(HTTP_TEST, TRUE);
- trace("emulated http test (to file)...\n");
- test_BindToStorage(HTTP_TEST, TRUE, TYMED_FILE);
+ trace("emulated http test (to file)...\n");
+ test_BindToStorage(HTTP_TEST, TRUE, TYMED_FILE);
- trace("about test...\n");
- test_BindToStorage(ABOUT_TEST, FALSE, TYMED_ISTREAM);
+ trace("asynchronous https test...\n");
+ test_BindToStorage(HTTPS_TEST, FALSE, TYMED_ISTREAM);
+
+ trace("emulated https test...\n");
+ test_BindToStorage(HTTPS_TEST, TRUE, TYMED_ISTREAM);
+
+ trace("about test...\n");
+ test_BindToStorage(ABOUT_TEST, FALSE, TYMED_ISTREAM);
- trace("about test (to file)...\n");
- test_BindToStorage(ABOUT_TEST, FALSE, TYMED_FILE);
+ trace("about test (to file)...\n");
+ test_BindToStorage(ABOUT_TEST, FALSE, TYMED_FILE);
- trace("about test (to object)...\n");
- test_BindToObject(ABOUT_TEST, FALSE);
+ trace("about test (to object)...\n");
+ test_BindToObject(ABOUT_TEST, FALSE);
- trace("emulated about test...\n");
- test_BindToStorage(ABOUT_TEST, TRUE, TYMED_ISTREAM);
+ trace("emulated about test...\n");
+ test_BindToStorage(ABOUT_TEST, TRUE, TYMED_ISTREAM);
- trace("emulated about test (to file)...\n");
- test_BindToStorage(ABOUT_TEST, TRUE, TYMED_FILE);
+ trace("emulated about test (to file)...\n");
+ test_BindToStorage(ABOUT_TEST, TRUE, TYMED_FILE);
- trace("emulated about test (to object)...\n");
- test_BindToObject(ABOUT_TEST, TRUE);
+ trace("emulated about test (to object)...\n");
+ test_BindToObject(ABOUT_TEST, TRUE);
- trace("file test...\n");
- test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
+ trace("file test...\n");
+ test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
- trace("file test (to file)...\n");
- test_BindToStorage(FILE_TEST, FALSE, TYMED_FILE);
+ trace("file test (to file)...\n");
+ test_BindToStorage(FILE_TEST, FALSE, TYMED_FILE);
- trace("file test (to object)...\n");
- test_BindToObject(FILE_TEST, FALSE);
+ trace("file test (to object)...\n");
+ test_BindToObject(FILE_TEST, FALSE);
- trace("emulated file test...\n");
- test_BindToStorage(FILE_TEST, TRUE, TYMED_ISTREAM);
+ trace("emulated file test...\n");
+ test_BindToStorage(FILE_TEST, TRUE, TYMED_ISTREAM);
- trace("emulated file test (to file)...\n");
- test_BindToStorage(FILE_TEST, TRUE, TYMED_FILE);
+ trace("emulated file test (to file)...\n");
+ test_BindToStorage(FILE_TEST, TRUE, TYMED_FILE);
- trace("emulated file test (to object)...\n");
- test_BindToObject(FILE_TEST, TRUE);
+ trace("emulated file test (to object)...\n");
+ test_BindToObject(FILE_TEST, TRUE);
- trace("emulated its test...\n");
- test_BindToStorage(ITS_TEST, TRUE, TYMED_ISTREAM);
+ trace("emulated its test...\n");
+ test_BindToStorage(ITS_TEST, TRUE, TYMED_ISTREAM);
- trace("emulated its test (to file)...\n");
- test_BindToStorage(ITS_TEST, TRUE, TYMED_FILE);
+ trace("emulated its test (to file)...\n");
+ test_BindToStorage(ITS_TEST, TRUE, TYMED_FILE);
- trace("emulated mk test...\n");
- test_BindToStorage(MK_TEST, TRUE, TYMED_ISTREAM);
+ trace("emulated mk test...\n");
+ test_BindToStorage(MK_TEST, TRUE, TYMED_ISTREAM);
- trace("test URLDownloadToFile for file protocol...\n");
- test_URLDownloadToFile(FILE_TEST, FALSE);
+ trace("test URLDownloadToFile for file protocol...\n");
+ test_URLDownloadToFile(FILE_TEST, FALSE);
- trace("test URLDownloadToFile for emulated file protocol...\n");
- test_URLDownloadToFile(FILE_TEST, TRUE);
+ trace("test URLDownloadToFile for emulated file protocol...\n");
+ test_URLDownloadToFile(FILE_TEST, TRUE);
- trace("test URLDownloadToFile for http protocol...\n");
- test_URLDownloadToFile(HTTP_TEST, FALSE);
+ trace("test URLDownloadToFile for http protocol...\n");
+ test_URLDownloadToFile(HTTP_TEST, FALSE);
- trace("test failures...\n");
- test_BindToStorage_fail();
+ bindf |= BINDF_NOWRITECACHE;
+
+ trace("ftp test...\n");
+ test_BindToStorage(FTP_TEST, FALSE, TYMED_ISTREAM);
+
+ trace("test failures...\n");
+ test_BindToStorage_fail();
+ }
- DeleteFileW(wszIndexHtml);
+ DeleteFileA(wszIndexHtmlA);
CloseHandle(complete_event);
CloseHandle(complete_event2);
CoUninitialize();
ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
PulseEvent(hevent);
+ SetLastError( 0xdeadbeef );
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0 );
- ok(ret==1, "Returned: %d\n", ret);
- ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
- PulseEvent(hevent);
-
- recips = BSM_APPLICATIONS;
- ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
- ok(ret==1, "Returned: %d\n", ret);
- ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
- PulseEvent(hevent);
-
- recips = BSM_APPLICATIONS;
- ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
- ok(!ret, "Returned: %d\n", ret);
- ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
- PulseEvent(hevent);
+ if (ret)
+ {
+ ok(ret==1, "Returned: %d\n", ret);
+ ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
+ PulseEvent(hevent);
+
+ recips = BSM_APPLICATIONS;
+ ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
+ ok(ret==1, "Returned: %d\n", ret);
+ ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
+ PulseEvent(hevent);
+
+ recips = BSM_APPLICATIONS;
+ ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
+ ok(!ret, "Returned: %d\n", ret);
+ ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
+ PulseEvent(hevent);
+ }
+ else /* BSF_SENDNOTIFYMESSAGE not supported on NT4 */
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "failed with err %u\n", GetLastError() );
recips = BSM_APPLICATIONS;
ret = broadcast( 0, &recips, WM_NULL, 100, 0 );
if (atom)
{
if (wc.lpszMenuName && menu_name)
- ok( !strcmp( menu_name, wc.lpszMenuName ), "Wrong name %s/%s for class %s %p\n",
+ ok_(__FILE__,line)( !strcmp( menu_name, wc.lpszMenuName ),
+ "Wrong name %s/%s for class %s %p\n",
- wc.lpszMenuName, menu_name, name, inst );
+ wc.lpszMenuName, menu_name, name, inst );
else
- ok( !menu_name == !wc.lpszMenuName, "Wrong name %p/%p for class %s %p\n",
+ ok_(__FILE__,line)( !menu_name == !wc.lpszMenuName, "Wrong name %p/%p for class %s %p\n",
- wc.lpszMenuName, menu_name, name, inst );
+ wc.lpszMenuName, menu_name, name, inst );
}
}
+ #define check_class(inst,name,menu) check_class_(__LINE__,inst,name,menu)
- static void check_instance( const char *name, HINSTANCE inst, HINSTANCE info_inst, HINSTANCE gcl_inst )
+ static void check_instance_( int line, const char *name, HINSTANCE inst,
+ HINSTANCE info_inst, HINSTANCE gcl_inst )
{
WNDCLASSA wc;
HWND hwnd;
- ok( GetClassInfo( inst, name, &wc ), "Couldn't find class %s inst %p\n", name, inst );
- ok( wc.hInstance == info_inst, "Wrong info instance %p/%p for class %s\n",
+ ok_(__FILE__,line)( GetClassInfo( inst, name, &wc ), "Couldn't find class %s inst %p\n", name, inst );
+ ok_(__FILE__,line)( wc.hInstance == info_inst, "Wrong info instance %p/%p for class %s\n",
- wc.hInstance, info_inst, name );
+ wc.hInstance, info_inst, name );
hwnd = CreateWindowExA( 0, name, "test_window", 0, 0, 0, 0, 0, 0, 0, inst, 0 );
- ok( hwnd != NULL, "Couldn't create window for class %s inst %p\n", name, inst );
- ok( (HINSTANCE)GetClassLongPtrA( hwnd, GCLP_HMODULE ) == gcl_inst,
+ ok_(__FILE__,line)( hwnd != NULL, "Couldn't create window for class %s inst %p\n", name, inst );
+ ok_(__FILE__,line)( (HINSTANCE)GetClassLongPtrA( hwnd, GCLP_HMODULE ) == gcl_inst,
- "Wrong GCL instance %p/%p for class %s\n",
+ "Wrong GCL instance %p/%p for class %s\n",
(HINSTANCE)GetClassLongPtrA( hwnd, GCLP_HMODULE ), gcl_inst, name );
- ok( (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ) == inst,
+ ok_(__FILE__,line)( (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ) == inst,
- "Wrong GWL instance %p/%p for window %s\n",
+ "Wrong GWL instance %p/%p for window %s\n",
(HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), inst, name );
- ok(!UnregisterClassA(name, inst), "UnregisterClassA should fail while exists a class window\n");
- ok(GetLastError() == ERROR_CLASS_HAS_WINDOWS, "GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %d\n", GetLastError());
+ ok_(__FILE__,line)(!UnregisterClassA(name, inst),
+ "UnregisterClassA should fail while exists a class window\n");
+ ok_(__FILE__,line)(GetLastError() == ERROR_CLASS_HAS_WINDOWS,
+ "GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %d\n", GetLastError());
DestroyWindow(hwnd);
}
+ #define check_instance(name,inst,info_inst,gcl_inst) check_instance_(__LINE__,name,inst,info_inst,gcl_inst)
struct class_info
{
SetLastError(0xdeadbeef);
ret = DestroyCursor(cursor);
- ok(!ret, "DestroyCursor on the active cursor succeeded\n");
+ ok(!ret || broken(ret) /* succeeds on win9x */, "DestroyCursor on the active cursor succeeded\n");
error = GetLastError();
ok(error == 0xdeadbeef, "Last error: %u\n", error);
-
+ if (!ret)
+ {
- cursor2 = GetCursor();
- ok(cursor2 == cursor, "Active was set to %p when trying to destroy it\n", cursor2);
- SetCursor(NULL);
-
- /* Trying to destroy the cursor properly fails now with
- * ERROR_INVALID_CURSOR_HANDLE. This happens because we called
- * DestroyCursor() 2+ times after calling SetCursor(). The calls to
- * GetCursor() and SetCursor(NULL) in between make no difference. */
- ret = DestroyCursor(cursor);
- todo_wine {
- ok(!ret, "DestroyCursor succeeded.\n");
- error = GetLastError();
+ cursor2 = GetCursor();
+ ok(cursor2 == cursor, "Active was set to %p when trying to destroy it\n", cursor2);
-
+ SetCursor(NULL);
+
+ /* Trying to destroy the cursor properly fails now with
+ * ERROR_INVALID_CURSOR_HANDLE. This happens because we called
+ * DestroyCursor() 2+ times after calling SetCursor(). The calls to
+ * GetCursor() and SetCursor(NULL) in between make no difference. */
+ ret = DestroyCursor(cursor);
+ todo_wine {
+ ok(!ret, "DestroyCursor succeeded.\n");
+ error = GetLastError();
- ok(error == ERROR_INVALID_CURSOR_HANDLE, "Last error: 0x%08x\n", error);
+ ok(error == ERROR_INVALID_CURSOR_HANDLE || error == 0xdeadbeef, /* vista */
+ "Last error: 0x%08x\n", error);
- }
++ }
}
DeleteObject(cursorInfo.hbmMask);
DdeGetLastError(client_pid);
hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
ret = DdeGetLastError(client_pid);
-todo_wine
- ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
+ ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
- {
- ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
+ todo_wine
- }
+ ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
if (hdata == NULL)
ok(FALSE, "hdata is NULL\n");
else
hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
ret = DdeGetLastError(client_pid);
ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
- todo_wine
- {
- ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
+ ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
- }
if (hdata == NULL)
ok(FALSE, "hdata is NULL\n");
else
ret = DdeGetLastError(client_pid);
ok(op == NULL, "Expected NULL, got %p\n", op);
ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
- todo_wine
- {
- ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
+ ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
- }
/* XTYP_EXECUTE, no data, -1 size */
res = 0xdeadbeef;
ret = DdeGetLastError(client_pid);
ok(op == NULL, "Expected NULL, got %p\n", op);
ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
- todo_wine
- {
- ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
+ ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
- }
DdeFreeStringHandle(client_pid, topic);
DdeFreeDataHandle(hdata);
hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
ret = DdeGetLastError(client_pid);
ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
- todo_wine
- {
- ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
+ ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
- }
if (hdata == NULL)
ok(FALSE, "hdata is NULL\n");
else
ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
ok(size == 12, "Expected 12, got %d\n", size);
- ptr = (LPSTR)DdeAccessData(hdata, &size);
+ if (msg_index == 9 || msg_index == 11)
+ {
+ ptr = (LPSTR)DdeAccessData(hdata, &size);
- if (msg_index == 9)
- {
- ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected '[Command(Var)]', got %s\n", ptr);
- ok(size == 15, "Expected 15, got %d\n", size);
- ret = (HDDEDATA)DDE_FACK;
- }
- else
- {
- ok(!lstrcmpA(ptr, "[BadCommand(Var)]"), "Expected '[BadCommand(Var)]', got %s\n", ptr);
- ok(size == 18, "Expected 18, got %d\n", size);
+ if (msg_index == 9)
+ {
+ ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected '[Command(Var)]', got %s\n", ptr);
+ ok(size == 15, "Expected 15, got %d\n", size);
+ ret = (HDDEDATA)DDE_FACK;
+ }
+ else
+ {
+ ok(!lstrcmpA(ptr, "[BadCommand(Var)]"), "Expected '[BadCommand(Var)]', got %s\n", ptr);
+ ok(size == 18, "Expected 18, got %d\n", size);
- ret = (HDDEDATA)DDE_FNOTPROCESSED;
+ ret = DDE_FNOTPROCESSED;
- }
+ }
- DdeUnaccessData(hdata);
+ DdeUnaccessData(hdata);
+ }
+ else if (msg_index == 10)
+ {
+ DWORD rsize = 0;
+ size = 0;
+
+ size = DdeGetData(hdata, NULL, 0, 0);
+ ok(size == 17, "DdeGetData should have returned 17 not %d\n", size);
+ ptr = HeapAlloc(GetProcessHeap(), 0, size);
+ ok(ptr != NULL,"HeapAlloc should have returned ptr not NULL\n");
+ rsize = DdeGetData(hdata, (LPBYTE)ptr, size, 0);
+ ok(rsize == size, "DdeGetData did not return %d bytes but %d\n", size, rsize);
+
+ ok(!lstrcmpA(ptr, "[Command-2(Var)]"), "Expected '[Command-2(Var)]' got %s\n", ptr);
+ ok(size == 17, "Expected 17, got %d\n", size);
+ ret = (HDDEDATA)DDE_FACK;
+
+ HeapFree(GetProcessHeap(), 0, ptr);
+ }
return ret;
}
/* WM_DDE_POKE, no ddepoke */
lparam = PackDDElParam(WM_DDE_POKE, 0, item);
- PostMessageA(server_hwnd, WM_DDE_POKE, (WPARAM)client_hwnd, lparam);
- flush_events();
+ /* win9x returns 0 here and crashes in PostMessageA */
+ if (lparam) {
-
+ PostMessageA(server_hwnd, WM_DDE_POKE, (WPARAM)client_hwnd, lparam);
+ flush_events();
+ }
+ else
+ win_skip("no lparam for WM_DDE_POKE\n");
+
/* WM_DDE_POKE, no item */
lparam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)hglobal, 0);
res = DdeInitializeA(&dde_inst, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
+ res = DdeInitializeA(&dde_inst2, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
+ ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
+
+ /* 0 instance id
+ * This block tests an invalid instance Id. The correct behaviour is that if the instance Id
+ * is invalid then the lastError of all instances is set to the error. There are two instances
+ * created, lastError is cleared, an error is generated and then both instances are checked to
+ * ensure that they both have the same error set
+ */
+ item = DdeCreateStringHandleA(0, "item", CP_WINANSI);
+ ok(item == NULL, "Expected NULL hsz got %p\n", item);
+ err = DdeGetLastError(dde_inst);
+ ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
+ err = DdeGetLastError(dde_inst2);
+ ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
+ item = DdeCreateStringHandleW(0, item_str, CP_WINUNICODE);
+ ok(item == NULL, "Expected NULL hsz got %p\n", item);
+ err = DdeGetLastError(dde_inst);
+ ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
+ err = DdeGetLastError(dde_inst2);
+ ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
+
item = DdeCreateStringHandleA(dde_inst, "item", CP_WINANSI);
ok(item != NULL, "Expected non-NULL hsz\n");
+ item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI);
+ ok(item != NULL, "Expected non-NULL hsz\n");
- /* invalid instance id */
- DdeGetLastError(dde_inst);
+ if (0) {
+ /* do not test with an invalid instance id: that crashes on win9x */
- hdata = DdeCreateDataHandle(0xdeadbeef, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
+ hdata = DdeCreateDataHandle(0xdeadbeef, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
- err = DdeGetLastError(dde_inst);
- todo_wine
- {
- ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
- ok(err == DMLERR_INVALIDPARAMETER,
- "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
}
- /* 0 instance id */
+ /* 0 instance id
+ * This block tests an invalid instance Id. The correct behaviour is that if the instance Id
+ * is invalid then the lastError of all instances is set to the error. There are two instances
+ * created, lastError is cleared, an error is generated and then both instances are checked to
+ * ensure that they both have the same error set
+ */
DdeGetLastError(dde_inst);
+ DdeGetLastError(dde_inst2);
hdata = DdeCreateDataHandle(0, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
err = DdeGetLastError(dde_inst);
- todo_wine
- {
- ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
+ ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
- ok(err == DMLERR_INVALIDPARAMETER,
- "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
- }
+ ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
+ err = DdeGetLastError(dde_inst2);
+ ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
+
+ ret = DdeUninitialize(dde_inst2);
+ ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
+
/* NULL pSrc */
DdeGetLastError(dde_inst);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_ADVISE, 0xcafe, 0xbeef);
- ptr = GlobalLock((HGLOBAL)lparam);
- ok(ptr != NULL, "Expected non-NULL ptr\n");
- ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
- ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+ /* win9x returns 0 here */
+ if (lparam) {
+ ptr = GlobalLock((HGLOBAL)lparam);
+ ok(ptr != NULL, "Expected non-NULL ptr\n");
+ ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
+ ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam);
- ok(ret == 1, "Expected 1, got %d\n", ret);
+ ret = GlobalUnlock((HGLOBAL)lparam);
+ ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0;
- ret = UnpackDDElParam(WM_DDE_ADVISE, lparam, &lo, &hi);
- ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
- ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ lo = hi = 0;
+ ret = UnpackDDElParam(WM_DDE_ADVISE, lparam, &lo, &hi);
+ ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+ ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
+ ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ }
+ else
+ win_skip("no lparam for WM_DDE_ADVISE\n");
ret = FreeDDElParam(WM_DDE_ADVISE, lparam);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef);
- ptr = GlobalLock((HGLOBAL)lparam);
- ok(ptr != NULL, "Expected non-NULL ptr\n");
- ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
- ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+ /* win9x returns the input (0xbeef<<16 | 0xcafe) here */
+ if (lparam != (int)0xbeefcafe) {
+ ptr = GlobalLock((HGLOBAL)lparam);
+ ok(ptr != NULL, "Expected non-NULL ptr\n");
+ ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
+ ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam);
- ok(ret == 1, "Expected 1, got %d\n", ret);
+ ret = GlobalUnlock((HGLOBAL)lparam);
+ ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0;
- ret = UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
- ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
- ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ lo = hi = 0;
+ ret = UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
+ ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+ ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
+ ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
- ret = FreeDDElParam(WM_DDE_ACK, lparam);
- ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+ ret = FreeDDElParam(WM_DDE_ACK, lparam);
+ ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-
- hglobal = GlobalFree((HGLOBAL)lparam);
- ok(hglobal == (HGLOBAL)lparam, "Expected lparam, got %d\n", ret);
- ok(GetLastError() == ERROR_INVALID_HANDLE,
- "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+ }
+ else
+ win_skip("got lparam 0x%lx for WM_DDE_ACK\n", lparam);
lparam = PackDDElParam(WM_DDE_DATA, 0xcafe, 0xbeef);
- ptr = GlobalLock((HGLOBAL)lparam);
- ok(ptr != NULL, "Expected non-NULL ptr\n");
- ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
- ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+ /* win9x returns 0 here */
+ if (lparam) {
+ ptr = GlobalLock((HGLOBAL)lparam);
+ ok(ptr != NULL, "Expected non-NULL ptr\n");
+ ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
+ ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam);
- ok(ret == 1, "Expected 1, got %d\n", ret);
+ ret = GlobalUnlock((HGLOBAL)lparam);
+ ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0;
- ret = UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi);
- ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
- ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ lo = hi = 0;
+ ret = UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi);
+ ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+ ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
+ ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ }
+ else
+ win_skip("no lparam for WM_DDE_DATA\n");
ret = FreeDDElParam(WM_DDE_DATA, lparam);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_POKE, 0xcafe, 0xbeef);
- ptr = GlobalLock((HGLOBAL)lparam);
- ok(ptr != NULL, "Expected non-NULL ptr\n");
- ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
- ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+ /* win9x returns 0 here */
+ if (lparam) {
+ ptr = GlobalLock((HGLOBAL)lparam);
+ ok(ptr != NULL, "Expected non-NULL ptr\n");
+ ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
+ ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam);
- ok(ret == 1, "Expected 1, got %d\n", ret);
+ ret = GlobalUnlock((HGLOBAL)lparam);
+ ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0;
- ret = UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi);
- ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
- ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ lo = hi = 0;
+ ret = UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi);
+ ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+ ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
+ ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+ }
+ else
+ win_skip("no lparam for WM_DDE_POKE\n");
ret = FreeDDElParam(WM_DDE_POKE, lparam);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0,0));
SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 0, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 0, "got %d\n", HIWORD(margins));
+ ok(LOWORD(margins) == 0 || broken(LOWORD(margins) == LOWORD(font_margins)), /* win95 */
+ "got %d\n", LOWORD(margins));
+ ok(HIWORD(margins) == 0 || broken(HIWORD(margins) == HIWORD(font_margins)), /* win95 */
+ "got %d\n", HIWORD(margins));
-
+
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(1,0));
SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(EC_USEFONTINFO,EC_USEFONTINFO));
margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 1, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 1, "got %d\n", HIWORD(margins));
+ ok(LOWORD(margins) == 1 || broken(LOWORD(margins) == LOWORD(font_margins)), /* win95 */
+ "got %d\n", LOWORD(margins));
+ ok(HIWORD(margins) == 1 || broken(HIWORD(margins) == HIWORD(font_margins)), /* win95 */
+ "got %d\n", HIWORD(margins));
+
SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont2, 0);
margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 1, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 1, "got %d\n", HIWORD(margins));
+ ok(LOWORD(margins) == 1 || broken(LOWORD(margins) != 1 && LOWORD(margins) != LOWORD(font_margins)), /* win95 */
+ "got %d\n", LOWORD(margins));
+ ok(HIWORD(margins) == 1 || broken(HIWORD(margins) != 1 && HIWORD(margins) != HIWORD(font_margins)), /* win95 */
+ "got %d\n", HIWORD(margins));
-
+
/* Above a certain size threshold then the margin is updated */
SetWindowPos(hwEdit, NULL, 10, 10, 1000, 100, SWP_NOZORDER | SWP_NOACTIVATE);
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(1,0));
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_ACCESSTIMEOUT(void)
{
MSGNAME[msg.message - WM_KEYFIRST], msg.wParam, msg.lParam, msg.time);
if( i < kmctr ) {
ok( msg.message == expmsg[i].message &&
- msg.wParam == expmsg[i].wParam &&
- msg.lParam == expmsg[i].lParam,
+ msg.wParam == expmsg[i].wParam &&
+ msg.lParam == expmsg[i].lParam,
- "wrong message! expected:\n"
- "message[%d] %-15s wParam %04lx lParam %08lx\n",i,
- MSGNAME[(expmsg[i]).message - WM_KEYFIRST],
- expmsg[i].wParam, expmsg[i].lParam );
+ "%u/%u: wrong message %x/%08lx/%08lx expected %s/%08lx/%08lx\n",
+ seqnr, i, msg.message, msg.wParam, msg.lParam,
+ MSGNAME[(expmsg[i]).message - WM_KEYFIRST], expmsg[i].wParam, expmsg[i].lParam );
}
i++;
}
static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam )
{
- switch (msg) {
- case WM_USER:
- SetFocus(hWnd);
- /* window has focus, now do the test */
- if( hWnd == hWndTest) TestSysKeys( hWnd);
- /* finished :-) */
- break;
-
- case WM_DESTROY:
- PostQuitMessage( 0 );
- break;
-
- default:
- return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
+ return DefWindowProcA( hWnd, msg, wParam, lParam );
-}
+ }
- return 0;
- }
-
static void test_Input_whitebox(void)
{
MSG msg;
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
wclass.hInstance = hInstance;
- wclass.hIcon = LoadIconA( 0, (LPSTR)IDI_APPLICATION );
+ wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
- wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
- wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
+ wclass.hCursor = LoadCursorA( NULL, IDC_ARROW);
+ wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1);
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
- assert (RegisterClassA( &wclass ));
+ RegisterClassA( &wclass );
/* create the test window that will receive the keystrokes */
- assert ( hWndTest = CreateWindowA( wclass.lpszClassName, "InputSysKeyTest",
+ hWndTest = CreateWindowA( wclass.lpszClassName, "InputSysKeyTest",
- WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100,
+ WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100,
- NULL, NULL, hInstance, NULL) );
+ NULL, NULL, hInstance, NULL);
+ assert( hWndTest );
ShowWindow( hWndTest, SW_SHOW);
+ SetWindowPos( hWndTest, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE );
+ SetForegroundWindow( hWndTest );
UpdateWindow( hWndTest);
/* flush pending messages */
DestroyWindow(hWndTest);
}
- static void empty_message_queue(void) {
+ /* try to make sure pending X events have been processed before continuing */
+ static void empty_message_queue(void)
+ {
MSG msg;
- while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ int diff = 200;
+ int min_timeout = 50;
+ DWORD time = GetTickCount() + diff;
+
+ while (diff > 0)
+ {
+ if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break;
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- diff = time - GetTickCount();
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
}
++ diff = time - GetTickCount();
++}
}
struct transition_s {
Msg != WM_NCHITTEST &&
Msg != WM_GETTEXT &&
Msg != WM_GETICON &&
- Msg != WM_DEVICECHANGE)
+ Msg != WM_IME_SELECT &&
+ Msg != WM_DEVICECHANGE &&
+ Msg != WM_TIMECHANGE)
{
- sent_messages[sent_messages_cnt].message = Msg;
- sent_messages[sent_messages_cnt].flags = 0;
- sent_messages[sent_messages_cnt].wParam = wParam;
- sent_messages[sent_messages_cnt++].lParam = HIWORD(lParam) & (KF_UP|KF_EXTENDED);
- }
+ ok(sent_messages_cnt < MAXKEYMESSAGES, "Too many messages\n");
+ if (sent_messages_cnt < MAXKEYMESSAGES)
+ {
+ sent_messages[sent_messages_cnt].message = Msg;
+ sent_messages[sent_messages_cnt].flags = 0;
+ sent_messages[sent_messages_cnt].wParam = wParam;
+ sent_messages[sent_messages_cnt++].lParam = HIWORD(lParam) & (KF_UP|KF_EXTENDED);
+ }
+ }
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
if (code == HC_ACTION)
{
- sent_messages[sent_messages_cnt].message = wparam;
- sent_messages[sent_messages_cnt].flags = hook;
- sent_messages[sent_messages_cnt].wParam = hook_info->vkCode;
- sent_messages[sent_messages_cnt++].lParam = hook_info->flags & (LLKHF_UP|LLKHF_EXTENDED);
+ ok(sent_messages_cnt < MAXKEYMESSAGES, "Too many messages\n");
+ if (sent_messages_cnt < MAXKEYMESSAGES)
+ {
+ sent_messages[sent_messages_cnt].message = wparam;
+ sent_messages[sent_messages_cnt].flags = hook;
+ sent_messages[sent_messages_cnt].wParam = hook_info->vkCode;
+ sent_messages[sent_messages_cnt++].lParam = hook_info->flags & (LLKHF_UP|LLKHF_EXTENDED);
+ }
if(0) /* For some reason not stable on Wine */
{
SetLastError(MYERROR);
count = 0;
retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, NULL, count, GMMP_USE_DISPLAY_POINTS);
- todo_wine {
+ if (retval == -1)
+ ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %u\n", GetLastError());
+ else
- ok(retval == count, "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
+ ok(retval == count, "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
- ok(MYERROR == GetLastError(),
- "expected error %d, got %u\n", MYERROR, GetLastError());
- }
/* test fourth parameter
* a value higher than 64 is expected to fail with ERROR_INVALID_PARAMETER
SetLastError(MYERROR);
count = 0;
retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, count, GMMP_USE_DISPLAY_POINTS);
- todo_wine {
+ if (retval == -1)
+ ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %u\n", GetLastError());
+ else
- ok(retval == count, "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
+ ok(retval == count, "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
- ok(MYERROR == GetLastError(),
- "expected error %d, got %u\n", MYERROR, GetLastError());
- }
SetLastError(MYERROR);
count = BUFLIM;
retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, count, GMMP_USE_DISPLAY_POINTS);
- todo_wine {
+ if (retval == -1)
+ ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %u\n", GetLastError());
+ else
- ok((0 <= retval) && (retval <= count), "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
+ ok((0 <= retval) && (retval <= count), "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
- ok(MYERROR == GetLastError(),
- "expected error %d, got %u\n", MYERROR, GetLastError());
- }
SetLastError(MYERROR);
retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
ok(kR == VK_SHIFT, "Scan code -> vKey = %x (not VK_SHIFT)\n", kR);
kL = MapVirtualKeyEx(0x2a, MAPVK_VSC_TO_VK_EX, kl);
- ok(kL == VK_LSHIFT, "Scan code -> vKey = %x (not VK_LSHIFT)\n", kL);
+ ok(kL == VK_LSHIFT || broken(kL == 0), /* win9x */
+ "Scan code -> vKey = %x (not VK_LSHIFT)\n", kL);
kR = MapVirtualKeyEx(0x36, MAPVK_VSC_TO_VK_EX, kl);
- ok(kR == VK_RSHIFT, "Scan code -> vKey = %x (not VK_RSHIFT)\n", kR);
+ ok(kR == VK_RSHIFT || broken(kR == 0), /* win9x */
+ "Scan code -> vKey = %x (not VK_RSHIFT)\n", kR);
+
+ /* test that MAPVK_VSC_TO_VK prefers the non-numpad vkey if there's ambiguity */
+ for (i = 0; i < sizeof(numpad_collisions)/sizeof(numpad_collisions[0]); i++)
+ {
+ UINT numpad_scan = MapVirtualKeyEx(numpad_collisions[i][0], MAPVK_VK_TO_VSC, kl);
+ UINT other_scan = MapVirtualKeyEx(numpad_collisions[i][1], MAPVK_VK_TO_VSC, kl);
+
+ /* do they really collide for this layout? */
+ if (numpad_scan && other_scan == numpad_scan)
+ {
+ UINT vkey = MapVirtualKeyEx(numpad_scan, MAPVK_VSC_TO_VK, kl);
+ ok(vkey != numpad_collisions[i][0],
+ "Got numpad vKey %x for scan code %x when there was another choice\n",
+ vkey, numpad_scan);
- }
++}
+ }
+ }
+
+ static void test_ToUnicode(void)
+ {
+ WCHAR wStr[2];
+ BYTE state[256];
+ const BYTE SC_RETURN = 0x1c, SC_TAB = 0x0f;
+ const BYTE HIGHEST_BIT = 0x80;
+ int i, ret;
+ for(i=0; i<256; i++)
+ state[i]=0;
+
+ SetLastError(0xdeadbeef);
+ ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0);
+ if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("ToUnicode is not implemented\n");
+ return;
+ }
+
+ ok(ret == 1, "ToUnicode for Return key didn't return 1 (was %i)\n", ret);
+ if(ret == 1)
+ ok(wStr[0]=='\r', "ToUnicode for CTRL + Return was %i (expected 13)\n", wStr[0]);
+ state[VK_CONTROL] |= HIGHEST_BIT;
+ state[VK_LCONTROL] |= HIGHEST_BIT;
+
+ ret = ToUnicode(VK_TAB, SC_TAB, state, wStr, 2, 0);
+ ok(ret == 0, "ToUnicode for CTRL + Tab didn't return 0 (was %i)\n", ret);
+
+ ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0);
+ ok(ret == 1, "ToUnicode for CTRL + Return didn't return 1 (was %i)\n", ret);
+ if(ret == 1)
+ ok(wStr[0]=='\n', "ToUnicode for CTRL + Return was %i (expected 10)\n", wStr[0]);
+
+ state[VK_SHIFT] |= HIGHEST_BIT;
+ state[VK_LSHIFT] |= HIGHEST_BIT;
+ ret = ToUnicode(VK_TAB, SC_TAB, state, wStr, 2, 0);
+ ok(ret == 0, "ToUnicode for CTRL + SHIFT + Tab didn't return 0 (was %i)\n", ret);
+ ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0);
+ todo_wine ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't return 0 (was %i)\n", ret);
+ }
+
+ static void test_get_async_key_state(void)
+ {
+ /* input value sanity checks */
+ ok(0 == GetAsyncKeyState(1000000), "GetAsyncKeyState did not return 0\n");
+ ok(0 == GetAsyncKeyState(-1000000), "GetAsyncKeyState did not return 0\n");
+ }
+
+ static void test_keyboard_layout_name(void)
+ {
+ BOOL ret;
+ char klid[KL_NAMELENGTH];
+
+ if (GetKeyboardLayout(0) != (HKL)(ULONG_PTR)0x04090409) return;
+
+ klid[0] = 0;
+ ret = GetKeyboardLayoutNameA(klid);
+ ok(ret, "GetKeyboardLayoutNameA failed %u\n", GetLastError());
+ ok(!strcmp(klid, "00000409"), "expected 00000409, got %s\n", klid);
}
START_TEST(input)
}
/* Test DDL_DIRECTORY|DDL_EXCLUSIVE. */
- strcpy(pathBuffer, "*");
+ strcpy(pathBuffer, wildcard);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res == 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed - 0x%08x\n", GetLastError());
+ ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n", GetLastError());
- /* There should be exactly one element: "[..]" */
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
- ok (itemCount == 1,
+ ok (itemCount == itemCount_allDirs,
"SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE) filled with %d entries, expected %d\n",
- itemCount, 1);
+ itemCount, itemCount_allDirs);
ok(res + 1 == itemCount, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) returned incorrect index!\n");
- memset(pathBuffer, 0, MAX_PATH);
- SendMessage(hList, LB_GETTEXT, 0, (LPARAM)pathBuffer);
+ if (itemCount && GetCurrentDirectoryA( MAX_PATH, pathBuffer ) > 3) /* there's no [..] in drive root */
+ {
- ok( !strcmp(pathBuffer, "[..]"), "First (and only) element is not [..]\n");
+ memset(pathBuffer, 0, MAX_PATH);
+ SendMessage(hList, LB_GETTEXT, 0, (LPARAM)pathBuffer);
+ ok( !strcmp(pathBuffer, "[..]"), "First element is not [..]\n");
+ }
/* This tests behavior when no files match the wildcard */
strcpy(pathBuffer, BAD_EXTENSION);
/* There should be exactly one element: "[..]" */
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
- ok (itemCount == 1,
+ ok (itemCount == itemCount_allDirs,
"DlgDirList(DDL_DIRECTORY|DDL_EXCLUSIVE) filled with %d entries, expected %d\n",
- itemCount, 1);
+ itemCount, itemCount_allDirs);
- memset(pathBuffer, 0, MAX_PATH);
- SendMessage(g_listBox, LB_GETTEXT, 0, (LPARAM)pathBuffer);
- ok( !strcmp(pathBuffer, "[..]"), "First (and only) element is not [..]\n");
+ if (itemCount && GetCurrentDirectoryA( MAX_PATH, pathBuffer ) > 3) /* there's no [..] in drive root */
+ {
-
+ memset(pathBuffer, 0, MAX_PATH);
+ SendMessage(g_listBox, LB_GETTEXT, 0, (LPARAM)pathBuffer);
+ ok( !strcmp(pathBuffer, "[..]"), "First (and only) element is not [..]\n");
+ }
/* Test behavior when no files match the wildcard */
strcpy(pathBuffer, BAD_EXTENSION);
DrawMenuBar( hwnd);
}
ret = GetMenuItemRect( hwnd, hmenu, 0, &rc);
- /* check menu width */
- if( ispop)
- expect = ( text || hbmp ?
- 4 + (mnuopt != 1 ? GetSystemMetrics(SM_CXMENUCHECK) : 0)
- : 0) +
+ if (0) /* comment out menu size checks, behavior is different in almost every Windows version */
+ /* the tests should however succeed on win2000, XP and Wine (at least up to 1.1.15) */
+ /* with a variety of dpis and desktop font sizes */
+ {
- arrowwidth + MOD_avec + (hbmp ? bmpsize.cx + 2 : 0) +
+ /* check menu width */
+ if( ispop)
+ expect = ( text || hbmp ?
+ 4 + (mnuopt != 1 ? GetSystemMetrics(SM_CXMENUCHECK) : 0)
+ : 0) +
- (text && hastab ? /* TAB space */
- MOD_avec + ( hastab==2 ? sc_size.cx : 0) : 0) +
- (text ? 2 + (text[0] ? size.cx :0): 0) ;
- else
- expect = !(text || hbmp) ? 0 :
- ( hbmp ? (text ? 2:0) + bmpsize.cx : 0 ) +
- (text ? 2 * MOD_avec + (text[0] ? size.cx :0): 0) ;
- ok( rc.right - rc.left == expect,
+ arrowwidth + MOD_avec + (hbmp ?
+ ((INT_PTR)hbmp<0||(INT_PTR)hbmp>12 ? bmpsize.cx + 2 : GetSystemMetrics( SM_CXMENUSIZE) + 2)
+ : 0) +
+ (text && hastab ? /* TAB space */
+ MOD_avec + ( hastab==2 ? sc_size.cx : 0) : 0) +
+ (text ? 2 + (text[0] ? size.cx :0): 0) ;
+ else
+ expect = !(text || hbmp) ? 0 :
+ ( hbmp ? (text ? 2:0) + bmpsize.cx : 0 ) +
+ (text ? 2 * MOD_avec + (text[0] ? size.cx :0): 0) ;
+ ok( rc.right - rc.left == expect,
"menu width wrong, got %d expected %d\n", rc.right - rc.left, expect);
- failed = failed || !(rc.right - rc.left == expect);
- /* check menu height */
- if( ispop)
- expect = max( ( !(text || hbmp) ? GetSystemMetrics( SM_CYMENUSIZE)/2 : 0),
- max( (text ? max( 2 + size.cy, MOD_hic + 4) : 0),
+ failed = failed || !(rc.right - rc.left == expect);
+ /* check menu height */
+ if( ispop)
+ expect = max( ( !(text || hbmp) ? GetSystemMetrics( SM_CYMENUSIZE)/2 : 0),
+ max( (text ? max( 2 + size.cy, MOD_hic + 4) : 0),
- (hbmp ? bmpsize.cy + 2 : 0)));
+ (hbmp ?
+ ((INT_PTR)hbmp<0||(INT_PTR)hbmp>12 ?
+ bmpsize.cy + 2
+ : GetSystemMetrics( SM_CYMENUSIZE) + 2)
+ : 0)));
- else
- expect = ( !(text || hbmp) ? GetSystemMetrics( SM_CYMENUSIZE)/2 :
- max( GetSystemMetrics( SM_CYMENU) - 1, (hbmp ? bmpsize.cy : 0)));
- ok( rc.bottom - rc.top == expect,
+ else
+ expect = ( !(text || hbmp) ? GetSystemMetrics( SM_CYMENUSIZE)/2 :
+ max( GetSystemMetrics( SM_CYMENU) - 1, (hbmp ? bmpsize.cy : 0)));
+ ok( rc.bottom - rc.top == expect,
"menu height wrong, got %d expected %d (%d)\n",
rc.bottom - rc.top, expect, GetSystemMetrics( SM_CYMENU));
- failed = failed || !(rc.bottom - rc.top == expect);
- if( hbmp == HBMMENU_CALLBACK && MOD_GotDrawItemMsg) {
- /* check the position of the bitmap */
- /* horizontal */
+ failed = failed || !(rc.bottom - rc.top == expect);
+ if( hbmp == HBMMENU_CALLBACK && MOD_GotDrawItemMsg) {
+ /* check the position of the bitmap */
+ /* horizontal */
- expect = ispop ? (4 + ( mnuopt ? 0 : GetSystemMetrics(SM_CXMENUCHECK)))
- : 3;
+ if (!ispop)
+ expect = 3;
+ else if (mnuopt == 0)
+ expect = 4 + GetSystemMetrics(SM_CXMENUCHECK);
+ else if (mnuopt == 1)
+ expect = 4;
+ else /* mnuopt == 2 */
+ expect = 2;
- ok( expect == MOD_rc[0].left,
+ ok( expect == MOD_rc[0].left,
"bitmap left is %d expected %d\n", MOD_rc[0].left, expect);
- failed = failed || !(expect == MOD_rc[0].left);
- /* vertical */
- expect = (rc.bottom - rc.top - MOD_rc[0].bottom + MOD_rc[0].top) / 2;
- ok( expect == MOD_rc[0].top,
+ failed = failed || !(expect == MOD_rc[0].left);
+ /* vertical */
+ expect = (rc.bottom - rc.top - MOD_rc[0].bottom + MOD_rc[0].top) / 2;
+ ok( expect == MOD_rc[0].top,
"bitmap top is %d expected %d\n", MOD_rc[0].top, expect);
- failed = failed || !(expect == MOD_rc[0].top);
- }
+ failed = failed || !(expect == MOD_rc[0].top);
+ }
+ }
/* if there was a failure, report details */
if( failed) {
- trace("*** count %d text \"%s\" bitmap %p bmsize %d,%d textsize %d+%d,%d mnuopt %d hastab %d\n",
- count, text ? text: "(nil)", hbmp, bmpsize.cx, bmpsize.cy,
+ trace("*** count %d %s text \"%s\" bitmap %p bmsize %d,%d textsize %d+%d,%d mnuopt %d hastab %d\n",
+ count, (ispop? "POPUP": "MENUBAR"),text ? text: "(nil)", hbmp, bmpsize.cx, bmpsize.cy,
size.cx, size.cy, sc_size.cx, mnuopt, hastab);
trace(" check %d,%d arrow %d avechar %d\n",
GetSystemMetrics(SM_CXMENUCHECK ),
return dst;
}
+ static void insert_menu_item( int line, HMENU hmenu, BOOL ansi, UINT mask, UINT type, UINT state, UINT id,
+ HMENU submenu, HBITMAP checked, HBITMAP unchecked, ULONG_PTR data,
+ void *type_data, UINT len, HBITMAP item, BOOL expect )
+ {
+ MENUITEMINFOA info;
+ BOOL ret;
- #define DMIINFF( i, e, field)\
- ok((int)((i)->field)==(int)((e)->field) || (int)((i)->field)==(0xffff & (int)((e)->field)), \
- "%s got 0x%x expected 0x%x\n", #field, (int)((i)->field), (int)((e)->field));
-
- #define DUMPMIINF(s,i,e)\
- {\
- DMIINFF( i, e, fMask)\
- DMIINFF( i, e, fType)\
- DMIINFF( i, e, fState)\
- DMIINFF( i, e, wID)\
- DMIINFF( i, e, hSubMenu)\
- DMIINFF( i, e, hbmpChecked)\
- DMIINFF( i, e, hbmpUnchecked)\
- DMIINFF( i, e, dwItemData)\
- DMIINFF( i, e, dwTypeData)\
- DMIINFF( i, e, cch)\
- if( s==sizeof(MENUITEMINFOA)) DMIINFF( i, e, hbmpItem)\
+ /* magic bitmap handle to test smaller cbSize */
+ if (item == (HBITMAP)(ULONG_PTR)0xdeadbeef)
+ info.cbSize = FIELD_OFFSET(MENUITEMINFOA,hbmpItem);
+ else
+ info.cbSize = sizeof(info);
+ info.fMask = mask;
+ info.fType = type;
+ info.fState = state;
+ info.wID = id;
+ info.hSubMenu = submenu;
+ info.hbmpChecked = checked;
+ info.hbmpUnchecked = unchecked;
+ info.dwItemData = data;
+ info.dwTypeData = type_data;
+ info.cch = len;
+ info.hbmpItem = item;
+ SetLastError( 0xdeadbeef );
+ if (ansi) ret = InsertMenuItemA( hmenu, 0, TRUE, &info );
+ else ret = InsertMenuItemW( hmenu, 0, TRUE, (MENUITEMINFOW*)&info );
+ if (!expect) ok_(__FILE__, line)( !ret, "InsertMenuItem should have failed.\n" );
+ else ok_(__FILE__, line)( ret, "InsertMenuItem failed, err %u\n", GetLastError());
+ }
+
+ static void check_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, UINT type, UINT state,
+ UINT id, HMENU submenu, HBITMAP checked, HBITMAP unchecked,
+ ULONG_PTR data, void *type_data, UINT in_len, UINT out_len,
+ HBITMAP item, LPCSTR expname, BOOL expect, BOOL expstring )
+ {
+ MENUITEMINFOA info;
+ BOOL ret;
+ WCHAR buffer[80];
+
+ SetLastError( 0xdeadbeef );
+ memset( &info, 0xcc, sizeof(info) );
+ info.cbSize = sizeof(info);
+ info.fMask = mask;
+ info.dwTypeData = type_data;
+ info.cch = in_len;
+
+ ret = ansi ? GetMenuItemInfoA( hmenu, 0, TRUE, &info ) :
+ GetMenuItemInfoW( hmenu, 0, TRUE, (MENUITEMINFOW *)&info );
+ if (!expect)
+ {
+ ok_(__FILE__, line)( !ret, "GetMenuItemInfo should have failed.\n" );
+ return;
- }
+}
+ ok_(__FILE__, line)( ret, "GetMenuItemInfo failed, err %u\n", GetLastError());
+ if (mask & MIIM_TYPE)
+ ok_(__FILE__, line)( info.fType == type || info.fType == LOWORD(type),
+ "wrong type %x/%x\n", info.fType, type );
+ if (mask & MIIM_STATE)
+ ok_(__FILE__, line)( info.fState == state || info.fState == LOWORD(state),
+ "wrong state %x/%x\n", info.fState, state );
+ if (mask & MIIM_ID)
+ ok_(__FILE__, line)( info.wID == id || info.wID == LOWORD(id),
+ "wrong id %x/%x\n", info.wID, id );
+ if (mask & MIIM_SUBMENU)
+ ok_(__FILE__, line)( info.hSubMenu == submenu || (ULONG_PTR)info.hSubMenu == LOWORD(submenu),
+ "wrong submenu %p/%p\n", info.hSubMenu, submenu );
+ if (mask & MIIM_CHECKMARKS)
+ {
+ ok_(__FILE__, line)( info.hbmpChecked == checked || (ULONG_PTR)info.hbmpChecked == LOWORD(checked),
+ "wrong bmpchecked %p/%p\n", info.hbmpChecked, checked );
+ ok_(__FILE__, line)( info.hbmpUnchecked == unchecked || (ULONG_PTR)info.hbmpUnchecked == LOWORD(unchecked),
+ "wrong bmpunchecked %p/%p\n", info.hbmpUnchecked, unchecked );
+ }
+ if (mask & MIIM_DATA)
+ ok_(__FILE__, line)( info.dwItemData == data || info.dwItemData == LOWORD(data),
+ "wrong item data %lx/%lx\n", info.dwItemData, data );
+ if (mask & MIIM_BITMAP)
+ ok_(__FILE__, line)( info.hbmpItem == item || (ULONG_PTR)info.hbmpItem == LOWORD(item),
+ "wrong bmpitem %p/%p\n", info.hbmpItem, item );
+ ok_(__FILE__, line)( info.dwTypeData == type_data || (ULONG_PTR)info.dwTypeData == LOWORD(type_data),
+ "wrong type data %p/%p\n", info.dwTypeData, type_data );
+ ok_(__FILE__, line)( info.cch == out_len, "wrong len %x/%x\n", info.cch, out_len );
+ if (expname)
+ {
+ if(ansi)
+ ok_(__FILE__, line)( !strncmp( expname, info.dwTypeData, out_len ),
+ "menu item name differed from '%s' '%s'\n", expname, info.dwTypeData );
+ else
+ ok_(__FILE__, line)( !strncmpW( (WCHAR *)expname, (WCHAR *)info.dwTypeData, out_len ),
+ "menu item name wrong\n" );
+
+ SetLastError( 0xdeadbeef );
+ ret = ansi ? GetMenuStringA( hmenu, 0, (char *)buffer, 80, MF_BYPOSITION ) :
+ GetMenuStringW( hmenu, 0, buffer, 80, MF_BYPOSITION );
+ if (expstring)
+ ok_(__FILE__, line)( ret, "GetMenuString failed, err %u\n", GetLastError());
+ else
+ ok_(__FILE__, line)( !ret, "GetMenuString should have failed\n" );
+ }
+ }
- /* insert menu item */
- #define TMII_INSMI( a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,\
- eret1)\
- {\
- MENUITEMINFOA info1=a1 b1,c1,d1,e1,f1,(void*)g1,(void*)h1,(void*)i1,j1,(void*)k1,l1,(void*)m1 n1;\
- HMENU hmenu = CreateMenu();\
- BOOL ret, stop = FALSE;\
- SetLastError( 0xdeadbeef);\
- if(ansi)strcpy( string, init);\
- else strcpyW( (WCHAR*)string, (WCHAR*)init);\
- if( ansi) ret = InsertMenuItemA(hmenu, 0, TRUE, &info1 );\
- else ret = InsertMenuItemW(hmenu, 0, TRUE, (MENUITEMINFOW*)&info1 );\
- if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)\
- {\
- skip("InsertMenuItem%s not implemented\n", ansi ? "A" : "W");\
- break;\
- }\
- if( !(eret1)) { ok( (eret1)==ret,"InsertMenuItem should have failed.\n");\
- stop = TRUE;\
- } else ok( (eret1)==ret,"InsertMenuItem failed, err %d\n",GetLastError());\
+ static void modify_menu( int line, HMENU hmenu, BOOL ansi, UINT flags, UINT_PTR id, void *data )
+ {
+ BOOL ret;
- if(ansi)strcpy( string, init );\
+ SetLastError( 0xdeadbeef );
+ if (ansi) ret = ModifyMenuA( hmenu, 0, flags, id, data );
+ else ret = ModifyMenuW( hmenu, 0, flags, id, data );
+ ok_(__FILE__,line)( ret, "ModifyMenuA failed, err %u\n", GetLastError());
+ }
+
+ static void set_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, UINT type, UINT state,
+ UINT id, HMENU submenu, HBITMAP checked, HBITMAP unchecked, ULONG_PTR data,
+ void *type_data, UINT len, HBITMAP item )
+
+ {
+ MENUITEMINFOA info;
+ BOOL ret;
+
+ /* magic bitmap handle to test smaller cbSize */
+ if (item == (HBITMAP)(ULONG_PTR)0xdeadbeef)
+ info.cbSize = FIELD_OFFSET(MENUITEMINFOA,hbmpItem);
+ else
+ info.cbSize = sizeof(info);
+ info.fMask = mask;
+ info.fType = type;
+ info.fState = state;
+ info.wID = id;
+ info.hSubMenu = submenu;
+ info.hbmpChecked = checked;
+ info.hbmpUnchecked = unchecked;
+ info.dwItemData = data;
+ info.dwTypeData = type_data;
+ info.cch = len;
+ info.hbmpItem = item;
+ SetLastError( 0xdeadbeef );
+ if (ansi) ret = SetMenuItemInfoA( hmenu, 0, TRUE, &info );
+ else ret = SetMenuItemInfoW( hmenu, 0, TRUE, (MENUITEMINFOW*)&info );
+ ok_(__FILE__, line)( ret, "SetMenuItemInfo failed, err %u\n", GetLastError());
+ }
+
+ #define TMII_INSMI( c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,eret1 )\
+ hmenu = CreateMenu();\
+ submenu = CreateMenu();\
++ if(ansi)strcpy( string, init);\
+ else strcpyW( string, init );\
+ insert_menu_item( __LINE__, hmenu, ansi, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, eret1 )
/* GetMenuItemInfo + GetMenuString */
- #define TMII_GMII( a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,l2,m2,n2,\
- a3,b3,c3,d3,e3,f3,g3,h3,i3,j3,k3,l3,m3,n3,\
+ #define TMII_GMII( c2,l2,\
+ d3,e3,f3,g3,h3,i3,j3,k3,l3,m3,\
expname, eret2, eret3)\
- {\
- MENUITEMINFOA info2A=a2 b2,c2,d2,e2,f2,(void*)g2,(void*)h2,(void*)i2,j2,(void*)k2,l2,(void*)m2 n2;\
- MENUITEMINFOA einfoA=a3 b3,c3,d3,e3,f3,(void*)g3,(void*)h3,(void*)i3,j3,(void*)k3,l3,(void*)m3 n3;\
- MENUITEMINFOA *info2 = &info2A;\
- MENUITEMINFOA *einfo = &einfoA;\
- MENUITEMINFOW *info2W = (MENUITEMINFOW *)&info2A;\
- if( !stop) {\
- SetLastError( 0xdeadbeef);\
- ret = ansi ? GetMenuItemInfoA( hmenu, 0, TRUE, info2 ) :\
- GetMenuItemInfoW( hmenu, 0, TRUE, info2W );\
- if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)\
- {\
- skip("GetMenuItemInfo%s not implemented\n", ansi ? "A" : "W");\
- break;\
- }\
- if( !(eret2)) ok( (eret2)==ret,"GetMenuItemInfo should have failed.\n");\
- else { \
- ok( (eret2)==ret,"GetMenuItemInfo failed, err %d\n",GetLastError());\
- ret = memcmp( info2, einfo, sizeof einfoA);\
- /* ok( ret==0, "Got wrong menu item info data\n");*/\
- if( ret) DUMPMIINF(info2A.cbSize, &info2A, &einfoA)\
- if( einfo->dwTypeData == string) {\
- if(ansi) ok( !strncmp( expname, info2->dwTypeData, einfo->cch ), "menu item name differed \"%s\"\n",\
- einfo->dwTypeData ? einfo->dwTypeData: "");\
- else ok( !strncmpW( (WCHAR*)expname, (WCHAR*)info2->dwTypeData, einfo->cch ), "menu item name differed \"%s\"\n",\
- einfo->dwTypeData ? einfo->dwTypeData: "");\
- ret = ansi ? GetMenuStringA( hmenu, 0, string, 80, MF_BYPOSITION) :\
- GetMenuStringW( hmenu, 0, string, 80, MF_BYPOSITION);\
- if( (eret3)){\
- ok( ret, "GetMenuString failed, err %d\n",GetLastError());\
- }else\
- ok( !ret, "GetMenuString should have failed\n");\
- }\
- }\
- }\
- }
+ check_menu_item_info( __LINE__, hmenu, ansi, c2, d3, e3, f3, g3, h3, i3, j3, k3, l2, l3, m3, \
+ expname, eret2, eret3 )
#define TMII_DONE \
RemoveMenu(hmenu, 0, TRUE );\
TMII_DONE
/* SEPARATOR and STRING go well together */
/* BITMAP and STRING go well together */
- TMII_INSMI( {, S, MIIM_STRING|MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_STRING, -9, -9, 0, -9, -9, -9, string, 4, hbm, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_STRING|MIIM_BITMAP, -1, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, 80,
+ MFT_STRING, 0, 0, 0, 0, 0, 0, string, 4, hbm,
+ txt, OK, OK );
TMII_DONE
/* BITMAP, SEPARATOR and STRING go well together */
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, string, 4, hbm, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, string, 4, hbm,
+ txt, OK, OK );
TMII_DONE
/* last two tests, but use MIIM_TYPE to retrieve info */
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING, MFT_SEPARATOR, -1, -1, -1, -1, -1, -1, txt, 6, -1, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, NULL, 4, NULL, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING, MFT_SEPARATOR, -1, -1, 0, 0, 0, -1, txt, 6, 0, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, NULL, 4, NULL,
+ NULL, OK, OK );
TMII_DONE
- TMII_INSMI( {, S, MIIM_STRING|MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_BITMAP, -9, -9, 0, -9, -9, -9, hbm, 4, hbm, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_STRING|MIIM_BITMAP, -1, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_BITMAP, 0, 0, 0, 0, 0, 0, hbm, 4, hbm,
+ NULL, OK, OK );
TMII_DONE
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR|MFT_BITMAP, -9, -9, 0, -9, -9, -9, hbm, 4, hbm, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR|MFT_BITMAP, 0, 0, 0, 0, 0, 0, hbm, 4, hbm,
+ NULL, OK, OK );
TMII_DONE
/* same three with MFT_OWNERDRAW */
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING, MFT_SEPARATOR|MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, txt, 6, -1, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR|MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, NULL, 4, NULL, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING, MFT_SEPARATOR|MFT_OWNERDRAW, -1, -1, 0, 0, 0, -1, txt, 6, 0, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, NULL, 4, NULL,
+ NULL, OK, OK );
TMII_DONE
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_BITMAP|MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, hbm, 4, hbm, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_OWNERDRAW, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_BITMAP|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, hbm, 4, hbm,
+ NULL, OK, OK );
TMII_DONE
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR|MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR|MFT_BITMAP|MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, hbm, 4, hbm, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR|MFT_OWNERDRAW, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR|MFT_BITMAP|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, hbm, 4, hbm,
+ NULL, OK, OK );
TMII_DONE
- TMII_INSMI( {, S, MIIM_STRING|MIIM_FTYPE|MIIM_ID, MFT_STRING|MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, txt, 0, -1, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, NULL, 4, NULL, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_STRING|MIIM_FTYPE|MIIM_ID, MFT_STRING|MFT_OWNERDRAW, -1, -1, 0, 0, 0, -1, txt, 0, 0, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, NULL, 4, NULL,
+ NULL, OK, OK );
TMII_DONE
/* test with modifymenu: string is preserved after setting OWNERDRAW */
- TMII_INSMI( {, S, MIIM_STRING, MFT_STRING, -1, -1, -1, -1, -1, -1, txt, 0, -1, }, OK)
- TMII_MODM( MFT_OWNERDRAW, -1, 787, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_DATA, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_DATA, MFT_OWNERDRAW, -9, -9, 0, -9, -9, 787, string, 4, -9, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_STRING, MFT_STRING, -1, -1, 0, 0, 0, -1, txt, 0, 0, OK );
+ TMII_MODM( MFT_OWNERDRAW, -1, (void*)787 );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_DATA, 80,
+ MFT_OWNERDRAW, 0, 0, 0, 0, 0, 787, string, 4, 0,
+ txt, OK, OK );
TMII_DONE
/* same with bitmap: now the text is cleared */
- TMII_INSMI( {, S, MIIM_STRING, MFT_STRING, -1, -1, -1, -1, -1, -1, txt, 0, -1, }, OK)
- TMII_MODM( MFT_BITMAP, 545, hbm, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, MFT_BITMAP, -9, 545, 0, -9, -9, -9, string, 0, hbm, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_STRING, MFT_STRING, -1, -1, 0, 0, 0, -1, txt, 0, 0, OK );
+ TMII_MODM( MFT_BITMAP, 545, hbm );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, 80,
+ MFT_BITMAP, 0, 545, 0, 0, 0, 0, string, 0, hbm,
+ empty, OK, ER );
TMII_DONE
/* start with bitmap: now setting text clears it (though he flag is raised) */
- TMII_INSMI( {, S, MIIM_BITMAP, MFT_STRING, -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, MFT_STRING, -9, 0, 0, -9, -9, -9, string, 0, hbm, },
- empty, OK, ER )
- TMII_MODM( MFT_STRING, 545, txt, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, MFT_STRING, -9, 545, 0, -9, -9, -9, string, 4, 0, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_BITMAP, MFT_STRING, -1, -1, 0, 0, 0, -1, 0, -1, hbm, OK );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, 80,
+ MFT_STRING, 0, 0, 0, 0, 0, 0, string, 0, hbm,
+ empty, OK, ER );
+ TMII_MODM( MFT_STRING, 545, txt );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, 80,
+ MFT_STRING, 0, 545, 0, 0, 0, 0, string, 4, 0,
+ txt, OK, OK );
TMII_DONE
/*repeat with text NULL */
- TMII_INSMI( {, S, MIIM_BITMAP, MFT_STRING, -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_MODM( MFT_STRING, 545, NULL, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, MFT_SEPARATOR, -9, 545, 0, -9, -9, -9, string, 0, 0, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_BITMAP, MFT_STRING, -1, -1, 0, 0, 0, -1, 0, -1, hbm, OK );
+ TMII_MODM( MFT_STRING, 545, NULL );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, 80,
+ MFT_SEPARATOR, 0, 545, 0, 0, 0, 0, string, 0, 0,
+ empty, OK, ER );
TMII_DONE
/* repeat with text "" */
- TMII_INSMI( {, S, MIIM_BITMAP, -1 , -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_MODM( MFT_STRING, 545, empty, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, MFT_STRING, -9, 545, 0, -9, -9, -9, string, 0, 0, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_BITMAP, -1 , -1, -1, 0, 0, 0, -1, 0, -1, hbm, OK );
+ TMII_MODM( MFT_STRING, 545, empty );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_ID, 80,
+ MFT_STRING, 0, 545, 0, 0, 0, 0, string, 0, 0,
+ empty, OK, ER );
TMII_DONE
/* start with bitmap: set ownerdraw */
- TMII_INSMI( {, S, MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_MODM( MFT_OWNERDRAW, -1, 232, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_DATA, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_DATA, MFT_OWNERDRAW, -9, -9, 0, -9, -9, 232, string, 0, hbm, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_BITMAP, -1, -1, -1, 0, 0, 0, -1, 0, -1, hbm, OK );
+ TMII_MODM( MFT_OWNERDRAW, -1, (void *)232 );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP|MIIM_DATA, 80,
+ MFT_OWNERDRAW, 0, 0, 0, 0, 0, 232, string, 0, hbm,
+ empty, OK, ER );
TMII_DONE
/* ask nothing */
- TMII_INSMI( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, 0, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, 0, -9, -9, -9, 0, -9, -9, -9, string, 80, -9, },
- init, OK, OK )
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, 0, 0, 0, -1, txt, 6, hbm, OK );
+ TMII_GMII ( 0, 80,
+ 0, 0, 0, 0, 0, 0, 0, string, 80, 0,
+ init, OK, OK );
TMII_DONE
- /* some tests with small cbSize: the hbmpItem is to be ignored */
+ /* some tests with small cbSize: the hbmpItem is to be ignored */
- TMII_INSMI( {, S - 4, MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, NULL, 0, NULL, },
- empty, OK, ER )
- TMII_DONE
- TMII_INSMI( {, S - 4, MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_BITMAP|MIIM_FTYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_BITMAP|MIIM_FTYPE, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, string, 80, NULL, },
- init, OK, ER )
- TMII_DONE
- TMII_INSMI( {, S - 4, MIIM_STRING|MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_STRING, -9, -9, 0, -9, -9, -9, string, 4, NULL, },
- txt, OK, OK )
- TMII_DONE
- TMII_INSMI( {, S - 4, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, NULL, 4, NULL, },
- txt, OK, OK )
- TMII_DONE
- TMII_INSMI( {, S - 4, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, NULL, 4, NULL, },
- txt, OK, OK )
- TMII_DONE
- TMII_INSMI( {, S - 4, MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR|MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, txt, 6, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_SEPARATOR|MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, NULL, 4, NULL, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_BITMAP, -1, -1, -1, 0, 0, 0, -1, 0, -1, dummy_hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
+ NULL, OK, ER );
+ TMII_DONE
+ TMII_INSMI( MIIM_BITMAP, -1, -1, -1, 0, 0, 0, -1, 0, -1, dummy_hbm, OK );
+ TMII_GMII ( MIIM_BITMAP|MIIM_FTYPE, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, string, 80, NULL,
+ init, OK, ER );
+ TMII_DONE
+ TMII_INSMI( MIIM_STRING|MIIM_BITMAP, -1, -1, -1, 0, 0, 0, -1, txt, 6, dummy_hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_STRING, 0, 0, 0, 0, 0, 0, string, 4, NULL,
+ txt, OK, OK );
+ TMII_DONE
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR, -1, -1, 0, 0, 0, -1, txt, 6, dummy_hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, NULL, 4, NULL,
+ NULL, OK, OK );
+ TMII_DONE
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_OWNERDRAW, -1, -1, 0, 0, 0, -1, txt, 6, dummy_hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, NULL, 4, NULL,
+ NULL, OK, OK );
+ TMII_DONE
+ TMII_INSMI( MIIM_FTYPE|MIIM_STRING|MIIM_BITMAP, MFT_SEPARATOR|MFT_OWNERDRAW, -1, -1, 0, 0, 0, -1, txt, 6, dummy_hbm, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_SEPARATOR|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, NULL, 4, NULL,
+ NULL, OK, OK );
TMII_DONE
/* MIIM_TYPE by itself does not get/set the dwItemData for OwnerDrawn menus */
- TMII_INSMI( {, S, MIIM_TYPE|MIIM_DATA, MFT_STRING|MFT_OWNERDRAW, -1, -1, -1, -1, -1, 343, txt, 0, -1, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE|MIIM_DATA, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE|MIIM_DATA, MFT_STRING|MFT_OWNERDRAW, -9, -9, 0, -9, -9, 343, 0, 0, 0, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_TYPE|MIIM_DATA, MFT_STRING|MFT_OWNERDRAW, -1, -1, 0, 0, 0, 343, txt, 0, 0, OK );
+ TMII_GMII ( MIIM_TYPE|MIIM_DATA, 80,
+ MFT_STRING|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 343, 0, 0, 0,
+ NULL, OK, ER );
TMII_DONE
- TMII_INSMI( {, S, MIIM_TYPE|MIIM_DATA, MFT_STRING|MFT_OWNERDRAW, -1, -1, -1, -1, -1, 343, txt, 0, -1, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_STRING|MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, 0, 0, 0, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_TYPE|MIIM_DATA, MFT_STRING|MFT_OWNERDRAW, -1, -1, 0, 0, 0, 343, txt, 0, 0, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_STRING|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ NULL, OK, ER );
TMII_DONE
- TMII_INSMI( {, S, MIIM_TYPE, MFT_STRING|MFT_OWNERDRAW, -1, -1, -1, -1, -1, 343, txt, 0, -1, }, OK)
- TMII_GMII ( {, S, MIIM_TYPE|MIIM_DATA, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE|MIIM_DATA, MFT_STRING|MFT_OWNERDRAW, -9, -9, 0, -9, -9, 0, 0, 0, 0, },
- empty, OK, ER )
+ TMII_INSMI( MIIM_TYPE, MFT_STRING|MFT_OWNERDRAW, -1, -1, 0, 0, 0, 343, txt, 0, 0, OK );
+ TMII_GMII ( MIIM_TYPE|MIIM_DATA, 80,
+ MFT_STRING|MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ NULL, OK, ER );
TMII_DONE
/* set a string menu to ownerdraw with MIIM_TYPE */
- TMII_INSMI( {, S, MIIM_TYPE, MFT_STRING, -2, -2, -2, -2, -2, -2, txt, -2, -2, }, OK)
- TMII_SMII( {, S, MIIM_TYPE, MFT_OWNERDRAW, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, OK)
- TMII_GMII ( {, S, MIIM_STRING|MIIM_FTYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_STRING|MIIM_FTYPE, MFT_OWNERDRAW, -9, -9, 0, -9, -9, -9, string, 4, -9, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_TYPE, MFT_STRING, -2, -2, 0, 0, 0, -2, txt, -2, 0, OK );
+ TMII_SMII ( MIIM_TYPE, MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ TMII_GMII ( MIIM_STRING|MIIM_FTYPE, 80,
+ MFT_OWNERDRAW, 0, 0, 0, 0, 0, 0, string, 4, 0,
+ txt, OK, OK );
TMII_DONE
/* test with modifymenu add submenu */
- TMII_INSMI( {, S, MIIM_STRING, MFT_STRING, -1, -1, -1, -1, -1, -1, txt, 0, -1, }, OK)
- TMII_MODM( MF_POPUP, submenu, txt, OK)
- TMII_GMII ( {, S, MIIM_FTYPE|MIIM_STRING|MIIM_SUBMENU, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_FTYPE|MIIM_STRING|MIIM_SUBMENU, MFT_STRING, -9, -9, submenu, -9, -9, -9, string, 4, -9, },
- txt, OK, OK )
- TMII_GMII ( {, S, MIIM_TYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_TYPE, MFT_STRING, -9, -9, 0, -9, -9, -9, string, 4, 0, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_STRING, MFT_STRING, -1, -1, 0, 0, 0, -1, txt, 0, 0, OK );
+ TMII_MODM( MF_POPUP, (UINT_PTR)submenu, txt );
+ TMII_GMII ( MIIM_FTYPE|MIIM_STRING|MIIM_SUBMENU, 80,
+ MFT_STRING, 0, 0, submenu, 0, 0, 0, string, 4, 0,
+ txt, OK, OK );
+ TMII_GMII ( MIIM_TYPE, 80,
+ MFT_STRING, 0, 0, 0, 0, 0, 0, string, 4, 0,
+ txt, OK, OK );
TMII_DONE
/* MFT_SEPARATOR bit is kept when the text is added */
- TMII_INSMI( {, S, MIIM_STRING|MIIM_FTYPE, MFT_STRING, -1, -1, -1, -1, -1, -1, NULL, 0, -1, }, OK)
- TMII_SMII( {, S, MIIM_STRING, -1, -1, -1, -1, -1, -1, -1, txt, -1, -1, }, OK)
- TMII_GMII ( {, S, MIIM_STRING|MIIM_FTYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_STRING|MIIM_FTYPE, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, string, 4, -9, },
- txt, OK, OK )
+ TMII_INSMI( MIIM_STRING|MIIM_FTYPE, MFT_STRING, -1, -1, 0, 0, 0, -1, NULL, 0, 0, OK );
+ TMII_SMII( MIIM_STRING, 0, 0, 0, 0, 0, 0, 0, txt, 0, 0 );
+ TMII_GMII ( MIIM_STRING|MIIM_FTYPE, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, string, 4, 0,
+ txt, OK, OK );
TMII_DONE
/* MFT_SEPARATOR bit is kept when bitmap is added */
- TMII_INSMI( {, S, MIIM_STRING|MIIM_FTYPE, MFT_STRING, -1, -1, -1, -1, -1, -1, NULL, 0, -1, }, OK)
- TMII_SMII( {, S, MIIM_BITMAP, -1, -1, -1, -1, -1, -1, -1, -1, -1, hbm, }, OK)
- TMII_GMII ( {, S, MIIM_BITMAP|MIIM_FTYPE, -9, -9, -9, -9, -9, -9, -9, string, 80, -9, },
- {, S, MIIM_BITMAP|MIIM_FTYPE, MFT_SEPARATOR, -9, -9, 0, -9, -9, -9, string, 80, hbm, },
- init, OK, ER )
+ TMII_INSMI( MIIM_STRING|MIIM_FTYPE, MFT_STRING, -1, -1, 0, 0, 0, -1, NULL, 0, 0, OK );
+ TMII_SMII( MIIM_BITMAP, 0, 0, 0, 0, 0, 0, 0, 0, 0, hbm );
+ TMII_GMII ( MIIM_BITMAP|MIIM_FTYPE, 80,
+ MFT_SEPARATOR, 0, 0, 0, 0, 0, 0, string, 80, hbm,
+ init, OK, ER );
TMII_DONE
/* Bitmaps inserted with MIIM_TYPE and MFT_BITMAP:
Only the low word of the dwTypeData is used.
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
wclass.hInstance = hInstance;
- wclass.hIcon = LoadIconA( 0, (LPSTR)IDI_APPLICATION );
- wclass.hCursor = LoadCursorA( NULL, (LPSTR)IDC_ARROW);
+ wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
+ wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
- wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
+ wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1);
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
wclass.hInstance = GetModuleHandleA( NULL );
- wclass.hIcon = LoadIconA( 0, (LPSTR)IDI_APPLICATION );
- wclass.hCursor = LoadCursorA( NULL, (LPSTR)IDC_ARROW);
+ wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
+ wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
- wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
+ wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1);
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
}
num++;
}
- ok(primary_num != -1, "Didn't get the primary device\n");
- if(pEnumDisplayMonitors && pGetMonitorInfoA) {
- ok(pEnumDisplayMonitors(NULL, NULL, monitor_enum_proc, (LPARAM)primary_monitor_device_name),
- "EnumDisplayMonitors failed\n");
+ if (primary_num == -1 || !pEnumDisplayMonitors || !pGetMonitorInfoA)
+ {
+ win_skip("EnumDisplayMonitors or GetMonitorInfoA are not available\n");
+ return;
+ }
- ok(!strcmp(primary_monitor_device_name, primary_device_name),
- "monitor device name %s, device name %s\n", primary_monitor_device_name,
- primary_device_name);
-}
+ primary_monitor_device_name[0] = 0;
+ ret = pEnumDisplayMonitors(NULL, NULL, monitor_enum_proc, (LPARAM)primary_monitor_device_name);
+ ok(ret, "EnumDisplayMonitors failed\n");
- }
+ ok(!strcmp(primary_monitor_device_name, primary_device_name),
+ "monitor device name %s, device name %s\n", primary_monitor_device_name,
+ primary_device_name);
+ }
struct vid_mode
{
{
init_function_pointers();
test_enumdisplaydevices();
- if (winetest_interactive)
- test_ChangeDisplaySettingsEx();
- test_monitors();
+ test_ChangeDisplaySettingsEx();
- if (pMonitorFromPoint && pMonitorFromWindow)
+ test_monitors();
- else
- skip("MonitorFromPoint and/or MonitorFromWindow are not available\n");
+ test_work_area();
}
if (expected->message == actual->message)
{
- if (expected->flags & wparam)
- {
- if (expected->wParam != actual->wParam && todo)
- {
- todo_wine {
- failcount ++;
- ok_( file, line) (FALSE,
- "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
- context, expected->message, expected->wParam, actual->wParam);
- }
- }
- else
- ok_( file, line) (expected->wParam == actual->wParam,
- "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
- context, expected->message, expected->wParam, actual->wParam);
- }
- if (expected->flags & lparam)
+ if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
+ (expected->flags & optional))
{
- if (expected->lParam != actual->lParam && todo)
- {
- todo_wine {
+ /* don't match messages if their defwinproc status differs */
+ expected++;
+ }
+ else
+ {
+ expected++;
+ actual++;
+ }
+ }
+ /* silently drop winevent messages if there is no support for them */
+ else if ((expected->flags & optional) || ((expected->flags & winevent_hook) && !hEvent_hook))
+ expected++;
+ else
+ {
+ expected++;
+ actual++;
+ }
+ count++;
+ }
+
+ /* optional trailing messages */
+ while (expected->message && ((expected->flags & optional) ||
+ ((expected->flags & winevent_hook) && !hEvent_hook)))
+ {
+ trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
+ expected++;
+ count++;
+ }
+
+ if (expected->message)
+ {
+ trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
+ return;
+ }
+
+ while (actual->message && actual->output[0])
+ {
+ trace_(file, line)( " %u: expected: nothing - actual: %s\n", count, actual->output );
+ actual++;
+ count++;
+ }
+ }
+
+ #define ok_sequence( exp, contx, todo) \
+ ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__)
+
+
+ static void ok_sequence_(const struct message *expected_list, const char *context, int todo,
- const char *file, int line)
++ const char *file, int line)
+ {
+ static const struct recvd_message end_of_sequence;
+ const struct message *expected = expected_list;
+ const struct recvd_message *actual;
+ int failcount = 0, dump = 0;
+ unsigned int count = 0;
-
++
+ add_message(&end_of_sequence);
+
+ actual = sequence;
+
+ while (expected->message && actual->message)
+ {
+ if (expected->message == actual->message)
+ {
+ if (expected->flags & wparam)
+ {
+ if (((expected->wParam ^ actual->wParam) & ~expected->wp_mask) && todo)
+ {
+ todo_wine {
+ failcount ++;
+ if (strcmp(winetest_platform, "wine")) dump++;
+ ok_( file, line) (FALSE,
+ "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
+ context, count, expected->message, expected->wParam, actual->wParam);
+ }
+ }
+ else
+ {
+ ok_( file, line)( ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
+ "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
+ context, count, expected->message, expected->wParam, actual->wParam);
+ if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) dump++;
- }
++ }
+
+ }
+ if (expected->flags & lparam)
+ {
+ if (((expected->lParam ^ actual->lParam) & ~expected->lp_mask) && todo)
+ {
+ todo_wine {
failcount ++;
+ if (strcmp(winetest_platform, "wine")) dump++;
ok_( file, line) (FALSE,
- "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
- context, expected->message, expected->lParam, actual->lParam);
+ "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
+ context, count, expected->message, expected->lParam, actual->lParam);
}
}
else
- ok_( file, line) (expected->lParam == actual->lParam,
- "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
- context, expected->message, expected->lParam, actual->lParam);
+ {
+ ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
+ "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
+ context, count, expected->message, expected->lParam, actual->lParam);
+ if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask) dump++;
- }
++ }
+ }
+ if ((expected->flags & optional) &&
+ ((expected->flags ^ actual->flags) & (defwinproc|parent)))
+ {
+ /* don't match optional messages if their defwinproc or parent status differs */
+ expected++;
+ count++;
+ continue;
}
if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
{
/* skip all optional trailing messages */
while (expected->message && ((expected->flags & optional) ||
- ((expected->flags & winevent_hook) && !hEvent_hook)))
+ ((expected->flags & hook) && !hCBT_hook) ||
+ ((expected->flags & winevent_hook) && !hEvent_hook)))
expected++;
if (todo)
else
{
if (expected->message || actual->message)
- ok_( file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
- context, expected->message, actual->message);
+ {
+ dump++;
+ ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
+ context, count, expected->message, actual->message);
- }
++ }
}
if( todo && !failcount) /* succeeded yet marked todo */
todo_wine {
return 0;
case WM_NCHITTEST:
return HTCLIENT;
-
- case WM_WINDOWPOSCHANGING:
- case WM_WINDOWPOSCHANGED:
- {
- WINDOWPOS *winpos = (WINDOWPOS *)lParam;
-
- trace("%s\n", (message == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED");
- trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
- winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
- dump_winpos_flags(winpos->flags);
-
- /* Log only documented flags, win2k uses 0x1000 and 0x2000
- * in the high word for internal purposes
- */
- wParam = winpos->flags & 0xffff;
- /* We are not interested in the flags that don't match under XP and Win9x */
- wParam &= ~(SWP_NOZORDER);
- break;
- }
+ }
- }
+ msg.hwnd = hwnd;
msg.message = message;
msg.flags = sent|wparam|lparam;
msg.wParam = wParam;
ok_sequence(WmHideOverlappedSeq, "ShowWindow(SW_HIDE):overlapped", FALSE);
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
+ flush_events();
ok_sequence(WmShowMaxOverlappedSeq, "ShowWindow(SW_SHOWMAXIMIZED):overlapped", TRUE);
+ flush_sequence();
- ShowWindow(hwnd, SW_RESTORE);
+ if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_MAXIMIZE)
+ {
- /* FIXME: add ok_sequence() here */
+ ShowWindow(hwnd, SW_RESTORE);
- flush_sequence();
+ flush_events();
+ ok_sequence(WmShowRestoreMaxOverlappedSeq, "ShowWindow(SW_RESTORE):overlapped", TRUE);
+ flush_sequence();
+ }
ShowWindow(hwnd, SW_MINIMIZE);
+ flush_events();
ok_sequence(WmShowMinOverlappedSeq, "ShowWindow(SW_SHOWMINIMIZED):overlapped", TRUE);
flush_sequence();
- ShowWindow(hwnd, SW_RESTORE);
+ if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_MINIMIZE)
+ {
- /* FIXME: add ok_sequence() here */
+ ShowWindow(hwnd, SW_RESTORE);
- flush_sequence();
+ flush_events();
+ ok_sequence(WmShowRestoreMinOverlappedSeq, "ShowWindow(SW_RESTORE):overlapped", TRUE);
+ flush_sequence();
+ }
ShowWindow(hwnd, SW_SHOW);
- ok_sequence(WmEmptySeq, "ShowWindow(SW_SHOW):overlapped already visible", FALSE);
+ flush_events();
+ ok_sequence(WmOptionalPaint, "ShowWindow(SW_SHOW):overlapped already visible", FALSE);
- ok(GetActiveWindow() == hwnd, "window should be active\n");
- ok(GetFocus() == hwnd, "window should have input focus\n");
SetWindowPos(hwnd, 0,0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE);
ok_sequence(WmSWP_HideOverlappedSeq, "SetWindowPos:SWP_HIDEWINDOW:overlapped", FALSE);
ok(!IsWindowVisible(hwnd), "window should not be visible at this point\n");
static LRESULT CALLBACK button_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- static long defwndproc_counter = 0;
+ static LONG defwndproc_counter = 0;
LRESULT ret;
- struct message msg;
-
- trace("button: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
+ struct recvd_message msg;
- /* explicitly ignore WM_GETICON message */
- if (message == WM_GETICON) return 0;
+ if (ignore_message( message )) return 0;
- msg.message = message;
- msg.flags = sent|wparam|lparam;
- if (defwndproc_counter) msg.flags |= defwinproc;
- msg.wParam = wParam;
- msg.lParam = lParam;
+ switch (message)
+ {
+ case WM_SYNCPAINT:
+ break;
+ case BM_SETSTATE:
+ ok(GetCapture() == hwnd, "GetCapture() = %p\n", GetCapture());
+ /* fall through */
+ default:
+ msg.hwnd = hwnd;
- add_message(&msg);
+ msg.message = message;
+ msg.flags = sent|wparam|lparam;
+ if (defwndproc_counter) msg.flags |= defwinproc;
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ msg.descr = "button";
-
- if (message == BM_SETSTATE)
- ok(GetCapture() == hwnd, "GetCapture() = %p\n", GetCapture());
+ add_message(&msg);
+ }
defwndproc_counter++;
ret = CallWindowProcA(old_button_proc, hwnd, message, wParam, lParam);
*/
trace("testing ValidateRect(0, NULL)\n");
SetRectEmpty( &rect );
- ok(ValidateRect(0, &rect), "ValidateRect(0, &rc) should not fail\n");
+ if (ValidateRect(0, &rect)) /* not supported on Win9x */
+ {
- check_update_rgn( hwnd, hrgn );
- ok_sequence( WmInvalidateErase, "InvalidateErase", FALSE );
- flush_events();
- ok_sequence( WmPaint, "Paint", FALSE );
- RedrawWindow( hwnd, NULL, NULL, RDW_VALIDATE );
- check_update_rgn( hwnd, 0 );
+ check_update_rgn( hwnd, hrgn );
+ ok_sequence( WmInvalidateErase, "InvalidateErase", FALSE );
+ flush_events();
+ ok_sequence( WmPaint, "Paint", FALSE );
+ RedrawWindow( hwnd, NULL, NULL, RDW_VALIDATE );
+ check_update_rgn( hwnd, 0 );
+ }
trace("testing InvalidateRgn(0, NULL, FALSE)\n");
SetLastError(0xdeadbeef);
CloseHandle(hThread);
ok(!IsWindow(wnd_event.hwnd), "window should be destroyed on thread exit\n");
- }
+
+ wnd_event.hwnd = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 100, 100, 200, 200, 0, 0, 0, NULL);
+ ok (wnd_event.hwnd != 0, "Failed to create parent window\n");
+ flush_sequence();
+ log_all_parent_messages++;
+ wnd_event.start_event = CreateEventA( NULL, TRUE, FALSE, NULL );
+ wnd_event.stop_event = CreateEventA( NULL, TRUE, FALSE, NULL );
+ hThread = CreateThread( NULL, 0, create_child_thread, &wnd_event, 0, &tid );
+ for (;;)
+ {
+ ret = MsgWaitForMultipleObjects(1, &wnd_event.start_event, FALSE, 1000, QS_SENDMESSAGE);
+ if (ret != 1) break;
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
++}
+ ok( !ret, "MsgWaitForMultipleObjects failed %x\n", ret );
+ /* now wait for the thread without processing messages; this shouldn't deadlock */
+ SetEvent( wnd_event.stop_event );
+ ret = WaitForSingleObject( hThread, 5000 );
+ ok( !ret, "WaitForSingleObject failed %x\n", ret );
+ CloseHandle( hThread );
+
+ ret = WaitForSingleObject( wnd_event.grand_child, 5000 );
+ ok( !ret, "WaitForSingleObject failed %x\n", ret );
+ CloseHandle( wnd_event.grand_child );
+
+ CloseHandle( wnd_event.start_event );
+ CloseHandle( wnd_event.stop_event );
+ flush_events();
+ ok_sequence(WmExitThreadSeq, "destroy child on thread exit", FALSE);
+ log_all_parent_messages--;
+ DestroyWindow( wnd_event.hwnd );
}
flush_events();
flush_sequence();
- keybd_event(VK_MENU, 0, 0, 0);
+ GetCursorPos(&pt);
+ if (pt.x == rc.left && pt.y == rc.top)
+ {
+ int i;
+ keybd_event(VK_SHIFT, 0, 0, 0);
- mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
- mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
+ mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
+ mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
- keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
- pump_msg_loop(hwnd, 0);
- ok_sequence(WmAltMouseButton, "Alt+MouseButton press/release", FALSE);
-
- trace("testing VK_F1 press/release\n");
- keybd_event(VK_F1, 0, 0, 0);
- keybd_event(VK_F1, 0, KEYEVENTF_KEYUP, 0);
- pump_msg_loop(hwnd, 0);
- ok_sequence(WmF1Seq, "F1 press/release", FALSE);
-
- trace("testing VK_APPS press/release\n");
- keybd_event(VK_APPS, 0, 0, 0);
- keybd_event(VK_APPS, 0, KEYEVENTF_KEYUP, 0);
+ keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
- pump_msg_loop(hwnd, 0);
+ pump_msg_loop(hwnd, 0);
- ok_sequence(WmVkAppsSeq, "VK_APPS press/release", FALSE);
+ for (i = 0; i < sequence_cnt; i++) if (sequence[i].message == WM_LBUTTONDOWN) break;
+ if (i < sequence_cnt)
+ ok_sequence(WmShiftMouseButton, "Shift+MouseButton press/release", FALSE);
+ else
+ skip( "Shift+MouseButton event didn't get to the window\n" );
+ }
+ done:
+ if (hAccel) DestroyAcceleratorTable(hAccel);
DestroyWindow(hwnd);
}
/* test_accelerators() depends on this */
case WM_NCHITTEST:
return HTCLIENT;
-
+
/* ignore */
case WM_MOUSEMOVE:
+ case WM_MOUSEACTIVATE:
+ case WM_NCMOUSEMOVE:
case WM_SETCURSOR:
- case WM_DEVICECHANGE:
+ case WM_IME_SELECT:
return 0;
- }
++ }
- case WM_WINDOWPOSCHANGING:
- case WM_WINDOWPOSCHANGED:
- {
- WINDOWPOS *winpos = (WINDOWPOS *)lParam;
-
- trace("%s\n", (message == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED");
- trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
- winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
- dump_winpos_flags(winpos->flags);
-
- /* Log only documented flags, win2k uses 0x1000 and 0x2000
- * in the high word for internal purposes
- */
- wParam = winpos->flags & 0xffff;
- /* We are not interested in the flags that don't match under XP and Win9x */
- wParam &= ~(SWP_NOZORDER);
- break;
- }
- }
-
+ msg.hwnd = hwnd;
msg.message = message;
msg.flags = sent|wparam|lparam;
if (defwndproc_counter) msg.flags |= defwinproc;
GetClientRect(parent, &rc);
trace("parent %p client size = (%d x %d)\n", parent, rc.right, rc.bottom);
-
- trace("ptReserved = (%d,%d)\n"
- "ptMaxSize = (%d,%d)\n"
- "ptMaxPosition = (%d,%d)\n"
- "ptMinTrackSize = (%d,%d)\n"
- "ptMaxTrackSize = (%d,%d)\n",
+ trace("Reserved=%d,%d MaxSize=%d,%d MaxPos=%d,%d MinTrack=%d,%d MaxTrack=%d,%d\n",
- minmax->ptReserved.x, minmax->ptReserved.y,
- minmax->ptMaxSize.x, minmax->ptMaxSize.y,
- minmax->ptMaxPosition.x, minmax->ptMaxPosition.y,
- minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y,
- minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y);
+ minmax->ptReserved.x, minmax->ptReserved.y,
+ minmax->ptMaxSize.x, minmax->ptMaxSize.y,
+ minmax->ptMaxPosition.x, minmax->ptMaxPosition.y,
+ minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y,
+ minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y);
ok(minmax->ptMaxSize.x == rc.right, "default width of maximized child %d != %d\n",
minmax->ptMaxSize.x, rc.right);
ret, rc.left, rc.top, rc.right, rc.bottom);
break;
}
-
- case WM_WINDOWPOSCHANGING:
- case WM_WINDOWPOSCHANGED:
- {
- WINDOWPOS *winpos = (WINDOWPOS *)lParam;
-
- trace("%s\n", (message == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED");
- trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
- winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
- dump_winpos_flags(winpos->flags);
-
- /* Log only documented flags, win2k uses 0x1000 and 0x2000
- * in the high word for internal purposes
- */
- wParam = winpos->flags & 0xffff;
- /* We are not interested in the flags that don't match under XP and Win9x */
- wParam &= ~(SWP_NOZORDER);
- break;
- }
-
- case WM_DRAWITEM:
- {
- /* encode DRAWITEMSTRUCT into an LPARAM */
- DRAW_ITEM_STRUCT di;
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
-
- trace("WM_DRAWITEM: type %x, ctl_id %x, item_id %x, action %x, state %x\n",
- dis->CtlType, dis->CtlID, dis->itemID, dis->itemAction, dis->itemState);
-
- di.u.item.type = dis->CtlType;
- di.u.item.ctl_id = dis->CtlID;
- di.u.item.item_id = dis->itemID;
- di.u.item.action = dis->itemAction;
- di.u.item.state = dis->itemState;
-
- logged_lParam = di.u.lp;
- break;
- }
+ }
- }
+ msg.hwnd = hwnd;
msg.message = message;
msg.flags = sent|parent|wparam|lparam;
if (defwndproc_counter) msg.flags |= defwinproc;
/* Log also SetFocus(0) calls */
hwnd = wParam ? (HWND)wParam : (HWND)lParam;
- if (GetClassNameA(hwnd, buf, sizeof(buf)))
+ if (is_our_logged_class(hwnd))
{
- if (!lstrcmpiA(buf, "TestWindowClass") ||
- !lstrcmpiA(buf, "ShowWindowClass") ||
- !lstrcmpiA(buf, "TestParentClass") ||
- !lstrcmpiA(buf, "TestPopupClass") ||
- !lstrcmpiA(buf, "SimpleWindowClass") ||
- !lstrcmpiA(buf, "TestDialogClass") ||
- !lstrcmpiA(buf, "MDI_frame_class") ||
- !lstrcmpiA(buf, "MDI_client_class") ||
- !lstrcmpiA(buf, "MDI_child_class") ||
- !lstrcmpiA(buf, "my_button_class") ||
- !lstrcmpiA(buf, "my_edit_class") ||
- !lstrcmpiA(buf, "static") ||
- !lstrcmpiA(buf, "ListBox") ||
- !lstrcmpiA(buf, "ComboBox") ||
- !lstrcmpiA(buf, "MyDialogClass") ||
- !lstrcmpiA(buf, "#32770"))
- {
- struct message msg;
+ struct recvd_message msg;
- msg.message = nCode;
- msg.flags = hook|wparam|lparam;
- msg.wParam = wParam;
- msg.lParam = lParam;
+ msg.hwnd = hwnd;
- add_message(&msg);
- }
+ msg.message = nCode;
+ msg.flags = hook|wparam|lparam;
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ msg.descr = "CBT";
- }
+ add_message(&msg);
+ }
return CallNextHookEx(hCBT_hook, nCode, wParam, lParam);
}
/* ignore mouse cursor events */
if (object_id == OBJID_CURSOR) return;
- if (!hwnd || GetClassNameA(hwnd, buf, sizeof(buf)))
+ if (!hwnd || is_our_logged_class(hwnd))
{
- if (!hwnd ||
- !lstrcmpiA(buf, "TestWindowClass") ||
- !lstrcmpiA(buf, "TestParentClass") ||
- !lstrcmpiA(buf, "TestPopupClass") ||
- !lstrcmpiA(buf, "SimpleWindowClass") ||
- !lstrcmpiA(buf, "TestDialogClass") ||
- !lstrcmpiA(buf, "MDI_frame_class") ||
- !lstrcmpiA(buf, "MDI_client_class") ||
- !lstrcmpiA(buf, "MDI_child_class") ||
- !lstrcmpiA(buf, "my_button_class") ||
- !lstrcmpiA(buf, "my_edit_class") ||
- !lstrcmpiA(buf, "static") ||
- !lstrcmpiA(buf, "ListBox") ||
- !lstrcmpiA(buf, "ComboBox") ||
- !lstrcmpiA(buf, "MyDialogClass") ||
- !lstrcmpiA(buf, "#32770"))
- {
- struct message msg;
+ struct recvd_message msg;
- msg.message = event;
- msg.flags = winevent_hook|wparam|lparam;
- msg.wParam = object_id;
- msg.lParam = child_id;
+ msg.hwnd = hwnd;
- add_message(&msg);
+ msg.message = event;
+ msg.flags = winevent_hook|wparam|lparam;
+ msg.wParam = object_id;
+ msg.lParam = child_id;
+ msg.descr = "WEH";
+ add_message(&msg);
+ }
}
--}
static const WCHAR wszUnicode[] = {'U','n','i','c','o','d','e',0};
static const WCHAR wszAnsi[] = {'U',0};
ok( KillTimer(info.hWnd, TIMER_ID), "KillTimer failed\n");
ok(DestroyWindow(info.hWnd), "failed to destroy window\n");
- }
+
+ /* Test timer callback with crash */
+ SetLastError(0xdeadbeef);
+ info.hWnd = CreateWindowW(testWindowClassW, NULL,
+ WS_OVERLAPPEDWINDOW ,
+ CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
+ NULL, NULL, 0);
+ if ((!info.hWnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) || /* Win9x/Me */
+ (!pGetMenuInfo)) /* Win95/NT4 */
+ {
+ win_skip("Test would crash on Win9x/WinMe/NT4\n");
+ DestroyWindow(info.hWnd);
+ return;
++}
+ info.id = SetTimer(info.hWnd, TIMER_ID, 0, tfunc_crash);
+ ok(info.id, "SetTimer failed\n");
+ Sleep(150);
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+
+ ok(DestroyWindow(info.hWnd), "failed to destroy window\n");
}
static int count = 0;
trace("start scroll\n");
ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL,
SW_SCROLLCHILDREN|SW_ERASE|SW_INVALIDATE);
- todo_wine { /* wine sends WM_POSCHANGING, WM_POSCHANGED messages */
+ /* wine sends WM_POSCHANGING, WM_POSCHANGED messages */
- /* windows sometimes a WM_MOVE */
+ /* windows sometimes a WM_MOVE */
- ok_sequence(WmEmptySeq, "ScrollWindowEx", 0);
- }
+ ok_sequence(WmEmptySeq, "ScrollWindowEx", TRUE);
trace("end scroll\n");
flush_sequence();
flush_events();
Sleep(100);
wait_for_thread( thread );
CloseHandle( thread );
- ok( info.ret == 0, "SendMessageTimeout succeeded\n" );
- ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
+ if (is_win9x)
+ {
+ ok( info.ret == 1, "SendMessageTimeout failed\n" );
+ ok_sequence( WmUser, "WmUser", FALSE );
+ }
+ else
+ {
+ ok( info.ret == 0, "SendMessageTimeout succeeded\n" );
+ ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
+ }
/* now check for timeout during message processing */
SetWindowLongPtrA( info.hwnd, GWLP_WNDPROC, (LONG_PTR)send_msg_delay_proc );
/* pass invalid QS_xxxx flags */
SetLastError(0xdeadbeef);
qstatus = GetQueueStatus(0xffffffff);
- ok(qstatus == 0, "GetQueueStatus should fail: %08x\n", qstatus);
+ ok(qstatus == 0 || broken(qstatus) /* win9x */, "GetQueueStatus should fail: %08x\n", qstatus);
+ if (!qstatus)
+ {
- ok(GetLastError() == ERROR_INVALID_FLAGS, "wrong error %d\n", GetLastError());
- qstatus = GetQueueStatus(qs_all_input);
+ ok(GetLastError() == ERROR_INVALID_FLAGS, "wrong error %d\n", GetLastError());
-
+ qstatus = GetQueueStatus(qs_all_input);
+ }
+ qstatus &= ~MAKELONG( 0x4000, 0x4000 ); /* sometimes set on Win95 */
ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE),
"wrong qstatus %08x\n", qstatus);
if (pSetWinEventHook)
{
- hEvent_hook = (HWINEVENTHOOK)pSetWinEventHook(EVENT_MIN, EVENT_MAX,
- GetModuleHandleA(0),
- win_event_proc,
- 0,
- GetCurrentThreadId(),
+ hEvent_hook = pSetWinEventHook(EVENT_MIN, EVENT_MAX,
+ GetModuleHandleA(0), win_event_proc,
+ 0, GetCurrentThreadId(),
- WINEVENT_INCONTEXT);
+ WINEVENT_INCONTEXT);
- assert(hEvent_hook);
-
- if (pIsWinEventHookInstalled)
+ if (pIsWinEventHookInstalled && hEvent_hook)
{
UINT event;
for (event = EVENT_MIN; event <= EVENT_MAX; event++)
ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
ok( out[0].fVirt == (ac[0].fVirt&0x7f), "fVirt not modified\n");
ok( out[0].key == ac[0].key, "key modified\n");
- ok( out[1].cmd == ac[1].cmd, "cmd modified\n");
- ok( out[1].fVirt == (ac[1].fVirt&0x7f), "fVirt not modified\n");
- ok( out[1].key == ac[1].key, "key modified\n");
+ if (res == 2)
+ {
+ ok( out[1].cmd == ac[1].cmd, "cmd modified\n");
+ ok( out[1].fVirt == (ac[1].fVirt&0x7f), "fVirt not modified\n");
+ ok( out[1].key == ac[1].key, "key modified\n");
+ }
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
}
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 3, 0);
ok(cIcons == 3, "Three icons requested got cIcons=%d\n", cIcons);
- cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(32,16), MAKELONG(32,16),
+ /* count must be a multiple of two when getting two sizes */
+ cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
- ahIcon, aIconId, 3, 0);
+ ahIcon, aIconId, 3, 0);
- ok(cIcons == 4, "Three icons requested, four expected, got cIcons=%d\n", cIcons);
+ ok(cIcons == 0 /* vista */ || cIcons == 4, "Three icons requested got cIcons=%d\n", cIcons);
+ cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
+ ahIcon, aIconId, 4, 0);
+ ok(cIcons == 4, "Four icons requested got cIcons=%d\n", cIcons);
}
static void test_LoadImage(void)
ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_BOTH );
ok( ret, "The scrollbar should be disabled.\n" );
- todo_wine
- {
- ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
+ ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
- }
ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
ok( ret, "The scrollbar should be enabled.\n" );
}
ok(0,"too many changes counter=%d last change=%d\n",
change_counter,change_last_param);
+ change_counter++;
+ change_last_param = wParam;
+ break;
}
change_counter++;
- change_last_param = wParam;
+ change_last_param = change_setworkarea_param = change_iconverticalspacing_param =0;
+ if( wParam == SPI_SETWORKAREA)
+ change_setworkarea_param = 1;
+ else if( wParam == SPI_ICONVERTICALSPACING)
+ change_iconverticalspacing_param = 1;
+ else
+ change_last_param = wParam;
break;
case WM_DESTROY:
rc=SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError());
if( usesetborder) {
- rc=SystemParametersInfoA( SPI_SETBORDER, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
+ rc=SystemParametersInfoA( SPI_SETBORDER, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
+ if (!test_error_msg(rc,"SPI_SETBORDER")) return FALSE;
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,GetLastError());
test_change_message( SPI_SETBORDER, 1 );
} else { /* set non client metrics */
SetLastError(0xdeadbeef);
rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
- if (!test_error_msg(rc,"SPI_{GET,SET}MOUSEBUTTONSWAP"))
- break;
+ if (!test_error_msg(rc,"SPI_SETMOUSEBUTTONSWAP")) return;
-
+
test_change_message( SPI_SETMOUSEBUTTONSWAP, 0 );
test_reg_key( SPI_SETMOUSEBUTTONSWAP_REGKEY,
SPI_SETMOUSEBUTTONSWAP_VALNAME,
rc=SystemParametersInfoA( SPI_SETSCREENREADER, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
+ if (!test_error_msg(rc,"SPI_SETSCREENREADER")) return;
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
- test_change_message( SPI_SETSCREENREADER, 0 );
- test_reg_key_ex2( SPI_SETSCREENREADER_REGKEY, SPI_SETSCREENREADER_REGKEY_LEGACY,
+ test_change_message( SPI_SETSCREENREADER, 1 );
+ test_reg_key_ex2_optional( SPI_SETSCREENREADER_REGKEY, SPI_SETSCREENREADER_REGKEY_LEGACY,
- SPI_SETSCREENREADER_VALNAME, SPI_SETSCREENREADER_VALNAME_LEGACY,
- vals[i] ? "1" : "0" );
+ SPI_SETSCREENREADER_VALNAME, SPI_SETSCREENREADER_VALNAME_LEGACY,
+ vals[i] ? "1" : "0" );
rc=SystemParametersInfoA( SPI_GETSCREENREADER, 0, &v, 0 );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
rc=SystemParametersInfoA( SPI_SETLOWPOWERACTIVE, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
+ if (!test_error_msg(rc,"SPI_SETLOWPOWERACTIVE")) return;
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
- test_change_message( SPI_SETLOWPOWERACTIVE, 0 );
- test_reg_key( SPI_SETLOWPOWERACTIVE_REGKEY,
+ test_change_message( SPI_SETLOWPOWERACTIVE, 1 );
+ test_reg_key_optional( SPI_SETLOWPOWERACTIVE_REGKEY,
- SPI_SETLOWPOWERACTIVE_VALNAME,
- vals[i] ? "1" : "0" );
+ SPI_SETLOWPOWERACTIVE_VALNAME,
+ vals[i] ? "1" : "0" );
+ /* SPI_SETLOWPOWERACTIVE is not persistent in win2k3 and above */
+ v = 0xdeadbeef;
rc=SystemParametersInfoA( SPI_GETLOWPOWERACTIVE, 0, &v, 0 );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
- eq( v, vals[i], "SPI_GETLOWPOWERACTIVE", "%d" );
+ ok(v == vals[i] ||
+ broken(v == (0xdead0000 | vals[i])) || /* win98 only sets the low word */
+ v == 0, /* win2k3 */
+ "SPI_GETLOWPOWERACTIVE: got %d instead of 0 or %d\n", v, vals[i]);
}
rc=SystemParametersInfoA( SPI_SETLOWPOWERACTIVE, old_b, 0, SPIF_UPDATEINIFILE );
rc=SystemParametersInfoA( SPI_SETPOWEROFFACTIVE, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
+ if (!test_error_msg(rc,"SPI_SETPOWEROFFACTIVE")) return;
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
- test_change_message( SPI_SETPOWEROFFACTIVE, 0 );
- test_reg_key( SPI_SETPOWEROFFACTIVE_REGKEY,
+ test_change_message( SPI_SETPOWEROFFACTIVE, 1 );
+ test_reg_key_optional( SPI_SETPOWEROFFACTIVE_REGKEY,
- SPI_SETPOWEROFFACTIVE_VALNAME,
- vals[i] ? "1" : "0" );
+ SPI_SETPOWEROFFACTIVE_VALNAME,
+ vals[i] ? "1" : "0" );
+ /* SPI_SETPOWEROFFACTIVE is not persistent in win2k3 and above */
+ v = 0xdeadbeef;
rc=SystemParametersInfoA( SPI_GETPOWEROFFACTIVE, 0, &v, 0 );
ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
- eq( v, vals[i], "SPI_GETPOWEROFFACTIVE", "%d" );
+ ok(v == vals[i] ||
+ broken(v == (0xdead0000 | vals[i])) || /* win98 only sets the low word */
+ v == 0, /* win2k3 */
+ "SPI_GETPOWEROFFACTIVE: got %d instead of 0 or %d\n", v, vals[i]);
}
rc=SystemParametersInfoA( SPI_SETPOWEROFFACTIVE, old_b, 0, SPIF_UPDATEINIFILE );
wc.lpfnWndProc = SysParamsTestWndProc;
wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
wc.hInstance = hInstance;
- wc.hIcon = LoadIconA( 0, (LPSTR)IDI_APPLICATION );
- wc.hCursor = LoadCursorA( 0, (LPSTR)IDC_ARROW );
+ wc.hIcon = LoadIconA( 0, IDI_APPLICATION );
+ wc.hCursor = LoadCursorA( 0, IDC_ARROW );
- wc.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1 );
wc.lpszMenuName = 0;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
/* Wide char versions */
SetRect( &rect, 10,10, 100, 100);
SetLastError( 0);
- textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL );
+ heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL );
if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) {
- ok( !(rect.left == rect.right && rect.bottom == rect.top),
- "rectangle should NOT be empty.\n");
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT);
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL );
+ ok( EMPTY(rect),
+ "rectangle should be empty got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT);
+ ok( EMPTY(rect),
+ "rectangle should be empty got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ if (textheight) /* windows 2000 */
+ {
+ if (conform_xp)
+ win_skip("XP conformity failed, skipping XP tests. Probably win 2000\n");
+ conform_xp = FALSE;
- }
++ }
+ else
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT);
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+
+ if (conform_xp) {
+ /* Crashes on NT4 */
+ SetRect( &rect, 10,10, 100, 100);
+ heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT);
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ }
+
+
+ /* DT_SINGLELINE tests */
+
+ heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE);
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+
SetRect( &rect, 10,10, 100, 100);
- textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL );
- ok( (rect.left == rect.right && rect.bottom == rect.top),
- "rectangle should be empty.\n");
+ heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
+ ok( !EMPTY(rect) && MODIFIED(rect),
+ "rectangle should be modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+
SetRect( &rect, 10,10, 100, 100);
- textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
- ok( !(rect.left == rect.right && rect.bottom == rect.top),
- "rectangle should NOT be empty.\n");
+ textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
+ ok( !EMPTY(rect) && MODIFIED(rect),
+ "rectangle should be modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+
+ if (conform_xp) {
+ /* Crashes on NT4 */
+ SetRect( &rect, 10,10, 100, 100);
+ heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ }
+
SetRect( &rect, 10,10, 100, 100);
- textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
- ok( !(rect.left == rect.right && rect.bottom == rect.top),
- "rectangle should NOT be empty.\n");
+ heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+
+ SetRect( &rect, 10,10, 100, 100);
+ textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE);
+ ok( !EMPTY(rect) && !MODIFIED(rect),
+ "rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n",
+ rect.left, rect.top, rect.right, rect.bottom );
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+
+ /* further tests with NULL and empty strings */
+ heightcheck = textheight = DrawTextW(hdc, textW, 0, &rect, 0);
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ textheight = DrawTextExW(hdc, textW, 0, &rect, 0, NULL );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ heightcheck = textheight = DrawTextW(hdc, emptystringW, 0, &rect, 0);
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ textheight = DrawTextExW(hdc, emptystringW, 0, &rect, 0, NULL );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ heightcheck = textheight = DrawTextW(hdc, NULL, 0, &rect, 0);
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ textheight = DrawTextExW(hdc, NULL, 0, &rect, 0, NULL );
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ heightcheck = textheight = DrawTextW(hdc, emptystringW, -1, &rect, 0);
+ ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
+ textheight = DrawTextExW(hdc, emptystringW, -1, &rect, 0, NULL );
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ if (conform_xp) {
+ /* Crashes on NT4 */
+ heightcheck = textheight = DrawTextW(hdc, NULL, -1, &rect, 0);
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ textheight = DrawTextExW(hdc, NULL, -1, &rect, 0, NULL );
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ heightcheck = textheight = DrawTextW(hdc, NULL, 10, &rect, 0);
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ textheight = DrawTextExW(hdc, NULL, 10, &rect, 0, NULL );
+ ok(textheight==0,"Got textheight from DrawTextW\n");
+ ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
+ }
+
+ dtp.cbSize = -1; /* Invalid */
+ dtp.uiLengthDrawn = 1337;
+ textheight = DrawTextExW(hdc, textW, 0, &rect, 0, &dtp);
+ ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
+ ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
+ dtp.uiLengthDrawn = 1337;
+ textheight = DrawTextExW(hdc, emptystringW, 0, &rect, 0, &dtp);
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+ ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
+ dtp.uiLengthDrawn = 1337;
+ textheight = DrawTextExW(hdc, NULL, 0, &rect, 0, &dtp);
+ if (conform_xp)
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+ ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
+ dtp.uiLengthDrawn = 1337;
+ textheight = DrawTextExW(hdc, emptystringW, -1, &rect, 0, &dtp);
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+ ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
+ if (conform_xp) {
+ /* Crashes on NT4 */
+ dtp.uiLengthDrawn = 1337;
+ textheight = DrawTextExW(hdc, NULL, -1, &rect, 0, &dtp);
+ ok(textheight==0,"Got textheight from DrawTextExW\n");
+ ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
+ }
}
/* More test cases from bug 12226 */
SetRect(&rect, 0, 0, 0, 0);
textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT | DT_LEFT | DT_SINGLELINE);
- todo_wine ok(textheight, "DrawTextW error %u\n", GetLastError());
+ if (!textheight && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip( "DrawTextW not implemented\n" );
+ }
+ else
+ {
+ ok(textheight, "DrawTextW error %u\n", GetLastError());
- ok(0 == rect.left, "expected 0, got %d\n", rect.left);
- ok(0 == rect.right, "expected 0, got %d\n", rect.right);
- ok(0 == rect.top, "expected 0, got %d\n", rect.top);
+ ok(0 == rect.left, "expected 0, got %d\n", rect.left);
+ ok(0 == rect.right, "expected 0, got %d\n", rect.right);
+ ok(0 == rect.top, "expected 0, got %d\n", rect.top);
- todo_wine ok(rect.bottom, "rect.bottom should not be 0\n");
+ ok(rect.bottom, "rect.bottom should not be 0\n");
+ }
SelectObject(hdc, hOldFont);
ret = DeleteObject(hFont);
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
- <group>
<module name="user32_winetest" type="win32cui" installbase="bin" installname="user32_winetest.exe" allowwarnings="true">
- <include base="user32_winetest">.</include>
+ <include base="user32_winetest">.</include>
- <define name="__USE_W32API" />
- <define name="_WIN32_WINNT">0x0600</define>
- <define name="WINVER">0x609</define>
+ <include base="ReactOS">include/reactos/wine</include>
+ <define name="__ROS_LONG64__" />
- <library>ntdll</library>
- <library>user32</library>
- <library>gdi32</library>
- <library>advapi32</library>
- <file>broadcast.c</file>
- <file>class.c</file>
- <file>clipboard.c</file>
- <file>combo.c</file>
- <file>cursoricon.c</file>
- <file>dce.c</file>
- <file>dde.c</file>
- <file>dialog.c</file>
- <file>edit.c</file>
- <!-- <file>generated.c</file> -->
- <file>input.c</file>
- <file>listbox.c</file>
- <file>menu.c</file>
- <file>monitor.c</file>
- <file>msg.c</file>
- <file>resource.c</file>
- <file>scroll.c</file>
- <file>static.c</file>
- <file>sysparams.c</file>
- <file>text.c</file>
- <file>win.c</file>
- <file>winstation.c</file>
- <file>wsprintf.c</file>
- <file>testlist.c</file>
- <file>resource.rc</file>
+ <library>ntdll</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <library>advapi32</library>
- <library>kernel32</library>
+ <file>broadcast.c</file>
+ <file>class.c</file>
+ <file>clipboard.c</file>
+ <file>combo.c</file>
+ <file>cursoricon.c</file>
+ <file>dce.c</file>
+ <file>dde.c</file>
+ <file>dialog.c</file>
+ <file>edit.c</file>
+ <!-- <file>generated.c</file> -->
+ <file>input.c</file>
+ <file>listbox.c</file>
+ <file>menu.c</file>
+ <file>monitor.c</file>
+ <file>msg.c</file>
+ <file>resource.c</file>
+ <file>scroll.c</file>
+ <file>static.c</file>
+ <file>sysparams.c</file>
+ <file>text.c</file>
+ <file>win.c</file>
+ <file>winstation.c</file>
+ <file>wsprintf.c</file>
+ <file>testlist.c</file>
+ <file>resource.rc</file>
</module>
- </group>
}
break;
}
- }
+ case HCBT_MOVESIZE:
+ case HCBT_MINMAX:
+ case HCBT_ACTIVATE:
+ case HCBT_SETFOCUS:
+ if (pGetWindowInfo && IsWindow(hwnd))
+ {
+ WINDOWINFO info;
+
+ /* Win98 actually does check the info.cbSize and doesn't allow
+ * it to be anything except sizeof(WINDOWINFO), while Win95, Win2k,
+ * WinXP do not check it at all.
+ */
+ info.cbSize = sizeof(WINDOWINFO);
+ ok(pGetWindowInfo(hwnd, &info), "GetWindowInfo should not fail\n");
+ verify_window_info(code_name, hwnd, &info);
++ }
+ break;
+ /* on HCBT_DESTROYWND window state is undefined */
+ case HCBT_DESTROYWND:
+ trace( "HCBT_DESTROYWND: hwnd %p\n", hwnd );
+ break;
+ default:
+ break;
}
return CallNextHookEx(hhook, nCode, wParam, lParam);
hwnd2 = SetActiveWindow(0);
ok(hwnd2 == hwnd, "SetActiveWindow returned %p instead of %p\n", hwnd2, hwnd);
- check_wnd_state(0, 0, 0, 0);
- hwnd2 = SetActiveWindow(hwnd);
- ok(hwnd2 == 0, "SetActiveWindow returned %p instead of 0\n", hwnd2);
+ if (!GetActiveWindow()) /* doesn't always work on vista */
+ {
-
+ check_wnd_state(0, 0, 0, 0);
+ hwnd2 = SetActiveWindow(hwnd);
+ ok(hwnd2 == 0, "SetActiveWindow returned %p instead of 0\n", hwnd2);
+ }
check_wnd_state(hwnd, hwnd, hwnd, 0);
SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW);
hwnd2 = SetActiveWindow(0);
ok(hwnd2 == hwnd, "SetActiveWindow(0) returned %p instead of %p\n", hwnd2, hwnd);
- check_wnd_state(0, 0, 0, 0);
+ if (GetActiveWindow() == hwnd) /* doesn't always work on vista */
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+ else
+ check_wnd_state(0, 0, 0, 0);
ret = SetForegroundWindow(hwnd);
- ok(ret, "SetForegroundWindow returned FALSE instead of TRUE\n");
+ if (!ret)
+ {
+ skip( "SetForegroundWindow not working\n" );
+ return;
+ }
check_wnd_state(hwnd, hwnd, hwnd, 0);
SetLastError(0xdeadbeef);
/*trace("testing SetForegroundWindow on an invisible window %p\n", hwnd);*/
ret = SetForegroundWindow(hwnd);
- ok(ret, "SetForegroundWindow returned FALSE instead of TRUE\n");
+ ok(ret || broken(!ret), /* win98 */ "SetForegroundWindow returned FALSE instead of TRUE\n");
check_wnd_state(hwnd, hwnd, hwnd, 0);
-
+
ShowWindow(hwnd, SW_SHOW);
check_wnd_state(hwnd, hwnd, hwnd, 0);
mouse_event(MOUSEEVENTF_MOVE, -1, -1, 0, 0);
ShowWindow(popup, SW_HIDE);
- ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+ ret = wait_for_message( &msg );
+ if (ret)
- ok(msg.hwnd == hwnd && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n", msg.hwnd, msg.message);
+ ok(msg.hwnd == hwnd && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n", msg.hwnd, msg.message);
flush_events( TRUE );
mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
INT rc;
/* Just a param check */
- SetLastError(0xdeadbeef);
- rc = GetWindowText(hwndMain2, NULL, 1024);
- ok( rc==0, "GetWindowText: rc=%d err=%d\n",rc,GetLastError());
+ if (pGetMonitorInfoA)
+ {
+ SetLastError(0xdeadbeef);
+ rc = GetWindowText(hwndMain2, NULL, 1024);
+ ok( rc==0, "GetWindowText: rc=%d err=%d\n",rc,GetLastError());
+ }
+ else
+ {
+ /* Skips actually on Win95 and NT4 */
+ win_skip("Test would crash on Win95\n");
+ }
SetLastError(0xdeadbeef);
hwnd=CreateWindow("LISTBOX", "TestList",
0, 0, 100, 100,
NULL, (HMENU)1, NULL, 0);
- ok(!hwnd, "CreateWindow with invalid menu handle should fail\n");
+ ok(!hwnd || broken(hwnd != NULL), /* w2k3 sp2 */
+ "CreateWindow with invalid menu handle should fail\n");
+ if (!hwnd)
- ok(GetLastError() == ERROR_INVALID_MENU_HANDLE || /* NT */
- GetLastError() == 0xdeadbeef, /* Win9x */
- "wrong last error value %d\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_MENU_HANDLE || /* NT */
+ GetLastError() == 0xdeadbeef, /* Win9x */
+ "wrong last error value %d\n", GetLastError());
}
static void test_AWRwindow(LPCSTR class, LONG style, LONG exStyle, BOOL menu)
if(waitResult != WAIT_TIMEOUT)
{
GetUpdateRect(hwnd, &updateRect, FALSE);
- todo_wine
- {
- ok(!IsRectEmpty(&updateRect), "Exposed rect should not be empty\n");
+ ok(IsRectEmpty(&updateRect), "Exposed rect should be empty\n");
- }
+}
- }
return 1;
}
DestroyWindow(mw);
}
- START_TEST(win)
+ static LRESULT CALLBACK TestNCRedraw_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+ {
+ static UINT ncredrawflags;
+ PAINTSTRUCT ps;
+
+ switch(msg)
+ {
+ case WM_CREATE:
+ ncredrawflags = *(UINT *) (((CREATESTRUCT *)lParam)->lpCreateParams);
+ return 0;
+ case WM_NCPAINT:
+ RedrawWindow(hwnd, NULL, NULL, ncredrawflags);
+ break;
+ case WM_PAINT:
+ BeginPaint(hwnd, &ps);
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
+ return DefWindowProc(hwnd, msg, wParam, lParam);
+ }
+
+ static void run_NCRedrawLoop(UINT flags)
+ {
+ HWND hwnd;
+ MSG msg;
+
+ UINT loopcount = 0;
+
+ hwnd = CreateWindowA("TestNCRedrawClass", "MainWindow",
+ WS_OVERLAPPEDWINDOW, 0, 0, 200, 100,
+ NULL, NULL, 0, &flags);
+ ShowWindow(hwnd, SW_SHOW);
+ UpdateWindow(hwnd);
+ while(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE) != 0)
+ {
+ if (msg.message == WM_PAINT) loopcount++;
+ if (loopcount >= 100) break;
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT);
+ }
+ if (flags == (RDW_INVALIDATE | RDW_FRAME))
+ todo_wine ok(loopcount < 100, "Detected infinite WM_PAINT loop (%x).\n", flags);
+ else
+ ok(loopcount < 100, "Detected infinite WM_PAINT loop (%x).\n", flags);
+ DestroyWindow(hwnd);
+ }
+
+ static void test_NCRedraw(void)
+ {
+ WNDCLASSA wndclass;
+
+ wndclass.lpszClassName = "TestNCRedrawClass";
+ wndclass.style = CS_HREDRAW | CS_VREDRAW;
+ wndclass.lpfnWndProc = TestNCRedraw_WndProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = 0;
+ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
+ wndclass.lpszMenuName = NULL;
+
+ RegisterClassA(&wndclass);
+
+ run_NCRedrawLoop(RDW_INVALIDATE | RDW_FRAME);
+ run_NCRedrawLoop(RDW_INVALIDATE);
+ }
+
+ static void test_GetWindowModuleFileName(void)
+ {
+ HWND hwnd;
+ HINSTANCE hinst;
+ UINT ret1, ret2;
+ char buf1[MAX_PATH], buf2[MAX_PATH];
+
+ if (!pGetWindowModuleFileNameA)
+ {
+ win_skip("GetWindowModuleFileNameA is not available\n");
+ return;
+ }
+
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0,0,0,0, 0, 0, 0, NULL);
+ assert(hwnd);
+
+ hinst = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
+ ok(hinst == 0 || broken(hinst == GetModuleHandle(0)), /* win9x */ "expected 0, got %p\n", hinst);
+
+ buf1[0] = 0;
+ SetLastError(0xdeadbeef);
+ ret1 = GetModuleFileName(hinst, buf1, sizeof(buf1));
+ ok(ret1, "GetModuleFileName error %u\n", GetLastError());
+
+ buf2[0] = 0;
+ SetLastError(0xdeadbeef);
+ ret2 = pGetWindowModuleFileNameA(hwnd, buf2, sizeof(buf2));
+ ok(ret2 || broken(!ret2), /* nt4 sp 3 */
+ "GetWindowModuleFileNameA error %u\n", GetLastError());
+
+ if (ret2)
+ {
+ ok(ret1 == ret2 || broken(ret2 == ret1 + 1), /* win98 */ "%u != %u\n", ret1, ret2);
+ ok(!strcmp(buf1, buf2), "%s != %s\n", buf1, buf2);
+ }
+ hinst = GetModuleHandle(0);
+
+ SetLastError(0xdeadbeef);
+ ret2 = GetModuleFileName(hinst, buf2, ret1 - 2);
+ ok(ret2 == ret1 - 2 || broken(ret2 == ret1 - 3), /* win98 */
+ "expected %u, got %u\n", ret1 - 2, ret2);
+ ok(GetLastError() == 0xdeadbeef /* XP */ ||
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER, /* win2k3, vista */
+ "expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret2 = GetModuleFileName(hinst, buf2, 0);
+ ok(!ret2, "GetModuleFileName should return 0\n");
+ ok(GetLastError() == 0xdeadbeef /* XP */ ||
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER, /* win2k3, vista */
+ "expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret2 = pGetWindowModuleFileNameA(hwnd, buf2, ret1 - 2);
+ ok(ret2 == ret1 - 2 || broken(ret2 == ret1 - 3) /* win98 */ || broken(!ret2), /* nt4 sp3 */
+ "expected %u, got %u\n", ret1 - 2, ret2);
+ ok(GetLastError() == 0xdeadbeef /* XP */ ||
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER, /* win2k3, vista */
+ "expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret2 = pGetWindowModuleFileNameA(hwnd, buf2, 0);
+ ok(!ret2, "expected 0, got %u\n", ret2);
+ ok(GetLastError() == 0xdeadbeef /* XP */ ||
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER, /* win2k3, vista */
+ "expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
+
+ DestroyWindow(hwnd);
+
+ buf2[0] = 0;
+ hwnd = (HWND)0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret1 = pGetWindowModuleFileNameA(hwnd, buf1, sizeof(buf1));
+ ok(!ret1, "expected 0, got %u\n", ret1);
+ ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef), /* win9x */
+ "expected ERROR_INVALID_WINDOW_HANDLE, got %u\n", GetLastError());
+
+ hwnd = FindWindow("Shell_TrayWnd", NULL);
+ ok(IsWindow(hwnd) || broken(!hwnd), "got invalid tray window %p\n", hwnd);
+ SetLastError(0xdeadbeef);
+ ret1 = pGetWindowModuleFileNameA(hwnd, buf1, sizeof(buf1));
+ ok(!ret1 || broken(ret1), /* win98 */ "expected 0, got %u\n", ret1);
+
+ if (!ret1) /* inter-process GetWindowModuleFileName works on win9x, so don't test the desktop there */
+ {
+ ret1 = GetModuleFileName(0, buf1, sizeof(buf1));
+ hwnd = GetDesktopWindow();
+ ok(IsWindow(hwnd), "got invalid desktop window %p\n", hwnd);
+ SetLastError(0xdeadbeef);
+ ret2 = pGetWindowModuleFileNameA(hwnd, buf2, sizeof(buf2));
+ ok(!ret2 ||
+ ret1 == ret2 || /* vista */
+ broken(ret2), /* some win98 return user.exe as file name */
+ "expected 0 or %u, got %u %s\n", ret1, ret2, buf2);
+ }
+ }
+
+ static void test_hwnd_message(void)
{
- pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
- pGetWindowInfo = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetWindowInfo" );
+ static const WCHAR mainwindowclassW[] = {'M','a','i','n','W','i','n','d','o','w','C','l','a','s','s',0};
+ static const WCHAR message_windowW[] = {'m','e','s','s','a','g','e',' ','w','i','n','d','o','w',0};
+
+ HWND parent = 0, hwnd, found;
+ RECT rect;
- hwndMain = CreateWindowExA(0, "static", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, NULL);
- if (hwndMain)
+ /* HWND_MESSAGE is not supported below w2k, but win9x return != 0
+ on CreateWindowExA and crash later in the test.
+ Use UNICODE here to fail on win9x */
+ hwnd = CreateWindowExW(0, mainwindowclassW, message_windowW, WS_CAPTION | WS_VISIBLE,
+ 100, 100, 200, 200, HWND_MESSAGE, 0, 0, NULL);
+ if (!hwnd)
{
- ok(!GetParent(hwndMain), "GetParent should return 0 for message only windows\n");
+ win_skip("CreateWindowExW with parent HWND_MESSAGE failed\n");
+ return;
+ }
+
+ ok( !GetParent(hwnd), "GetParent should return 0 for message only windows\n" );
- if (pGetAncestor)
- {
+ if (pGetAncestor)
+ {
- hwndMessage = pGetAncestor(hwndMain, GA_PARENT);
- ok(hwndMessage != 0, "GetAncestor(GA_PARENT) should not return 0 for message only windows\n");
- trace("hwndMessage %p\n", hwndMessage);
+ char buffer[100];
+ HWND root, desktop = GetDesktopWindow();
+
+ parent = pGetAncestor(hwnd, GA_PARENT);
+ ok(parent != 0, "GetAncestor(GA_PARENT) should not return 0 for message windows\n");
+ ok(parent != desktop, "GetAncestor(GA_PARENT) should not return desktop for message windows\n");
+ root = pGetAncestor(hwnd, GA_ROOT);
+ ok(root == hwnd, "GetAncestor(GA_ROOT) should return hwnd for message windows\n");
+ ok( !pGetAncestor(parent, GA_PARENT) || broken(pGetAncestor(parent, GA_PARENT) != 0), /* win2k */
+ "parent shouldn't have parent %p\n", pGetAncestor(parent, GA_PARENT) );
+ trace("parent %p root %p desktop %p\n", parent, root, desktop);
+ if (!GetClassNameA( parent, buffer, sizeof(buffer) )) buffer[0] = 0;
+ ok( !lstrcmpi( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
+ GetWindowRect( parent, &rect );
+ ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100,
+ "wrong parent rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
- }
++ }
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 100 && rect.right == 300 && rect.top == 100 && rect.bottom == 300,
+ "wrong window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
+ /* test FindWindow behavior */
+
+ found = FindWindowExA( 0, 0, 0, "message window" );
+ ok( found == hwnd, "didn't find message window %p/%p\n", found, hwnd );
+ SetLastError(0xdeadbeef);
+ found = FindWindowExA( GetDesktopWindow(), 0, 0, "message window" );
+ ok( found == 0, "found message window %p/%p\n", found, hwnd );
+ ok( GetLastError() == 0xdeadbeef, "expected deadbeef, got %d\n", GetLastError() );
+ if (parent)
+ {
+ found = FindWindowExA( parent, 0, 0, "message window" );
+ ok( found == hwnd, "didn't find message window %p/%p\n", found, hwnd );
+ }
+
+ /* test IsChild behavior */
+
+ if (parent) ok( !IsChild( parent, hwnd ), "HWND_MESSAGE is child of top window\n" );
+
+ /* test IsWindowVisible behavior */
+
+ ok( !IsWindowVisible( hwnd ), "HWND_MESSAGE window is visible\n" );
+ if (parent) ok( !IsWindowVisible( parent ), "HWND_MESSAGE parent is visible\n" );
+
+ DestroyWindow(hwnd);
+ }
+
+ static void test_layered_window(void)
+ {
+ HWND hwnd;
+ COLORREF key = 0;
+ BYTE alpha = 0;
+ DWORD flags = 0;
+ BOOL ret;
+
+ if (!pGetLayeredWindowAttributes || !pSetLayeredWindowAttributes)
+ {
+ win_skip( "layered windows not supported\n" );
+ return;
+ }
+ hwnd = CreateWindowExA(0, "MainWindowClass", "message window", WS_CAPTION,
+ 100, 100, 200, 200, 0, 0, 0, NULL);
+ assert( hwnd );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( !ret, "GetLayeredWindowAttributes should fail on non-layered window\n" );
+ ret = pSetLayeredWindowAttributes( hwnd, 0, 0, LWA_ALPHA );
+ ok( !ret, "SetLayeredWindowAttributes should fail on non-layered window\n" );
+ SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
+ ret = pSetLayeredWindowAttributes( hwnd, 0x123456, 44, LWA_ALPHA );
+ ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( ret, "GetLayeredWindowAttributes should succeed on layered window\n" );
+ ok( key == 0x123456 || key == 0, "wrong color key %x\n", key );
+ ok( alpha == 44, "wrong alpha %u\n", alpha );
+ ok( flags == LWA_ALPHA, "wrong flags %x\n", flags );
+
+ /* clearing WS_EX_LAYERED resets attributes */
+ SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( !ret, "GetLayeredWindowAttributes should fail on no longer layered window\n" );
+ SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
+ ret = pSetLayeredWindowAttributes( hwnd, 0x654321, 22, LWA_COLORKEY | LWA_ALPHA );
+ ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( ret, "GetLayeredWindowAttributes should succeed on layered window\n" );
+ ok( key == 0x654321, "wrong color key %x\n", key );
+ ok( alpha == 22, "wrong alpha %u\n", alpha );
+ ok( flags == (LWA_COLORKEY | LWA_ALPHA), "wrong flags %x\n", flags );
+
+ ret = pSetLayeredWindowAttributes( hwnd, 0x888888, 33, LWA_COLORKEY );
+ ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
+ alpha = 0;
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( ret, "GetLayeredWindowAttributes should succeed on layered window\n" );
+ ok( key == 0x888888, "wrong color key %x\n", key );
+ /* alpha not changed on vista if LWA_ALPHA is not set */
+ ok( alpha == 22 || alpha == 33, "wrong alpha %u\n", alpha );
+ ok( flags == LWA_COLORKEY, "wrong flags %x\n", flags );
+
+ /* color key may or may not be changed without LWA_COLORKEY */
+ ret = pSetLayeredWindowAttributes( hwnd, 0x999999, 44, 0 );
+ ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
+ alpha = 0;
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( ret, "GetLayeredWindowAttributes should succeed on layered window\n" );
+ ok( key == 0x888888 || key == 0x999999, "wrong color key %x\n", key );
+ ok( alpha == 22 || alpha == 44, "wrong alpha %u\n", alpha );
+ ok( flags == 0, "wrong flags %x\n", flags );
+
+ /* default alpha and color key is 0 */
+ SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ ret = pSetLayeredWindowAttributes( hwnd, 0x222222, 55, 0 );
+ ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
+ ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
+ ok( ret, "GetLayeredWindowAttributes should succeed on layered window\n" );
+ ok( key == 0 || key == 0x222222, "wrong color key %x\n", key );
+ ok( alpha == 0 || alpha == 55, "wrong alpha %u\n", alpha );
+ ok( flags == 0, "wrong flags %x\n", flags );
+
+ DestroyWindow( hwnd );
+ }
+
+ static MONITORINFO mi;
+
+ static LRESULT CALLBACK fullscreen_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+ {
+ switch (msg)
+ {
+ case WM_NCCREATE:
+ {
+ CREATESTRUCTA *cs = (CREATESTRUCTA *)lp;
+ trace("WM_NCCREATE: rect %d,%d-%d,%d\n", cs->x, cs->y, cs->cx, cs->cy);
+ ok(cs->x == mi.rcMonitor.left && cs->y == mi.rcMonitor.top &&
+ cs->cx == mi.rcMonitor.right && cs->cy == mi.rcMonitor.bottom,
+ "expected %d,%d-%d,%d, got %d,%d-%d,%d\n",
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ cs->x, cs->y, cs->cx, cs->cy);
+ break;
+ }
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO *minmax = (MINMAXINFO *)lp;
+ dump_minmax_info(minmax);
+ ok(minmax->ptMaxPosition.x <= mi.rcMonitor.left, "%d <= %d\n", minmax->ptMaxPosition.x, mi.rcMonitor.left);
+ ok(minmax->ptMaxPosition.y <= mi.rcMonitor.top, "%d <= %d\n", minmax->ptMaxPosition.y, mi.rcMonitor.top);
+ ok(minmax->ptMaxSize.x >= mi.rcMonitor.right, "%d >= %d\n", minmax->ptMaxSize.x, mi.rcMonitor.right);
+ ok(minmax->ptMaxSize.y >= mi.rcMonitor.bottom, "%d >= %d\n", minmax->ptMaxSize.y, mi.rcMonitor.bottom);
+ break;
+ }
+ }
+ return DefWindowProc(hwnd, msg, wp, lp);
+ }
+
+ static void test_fullscreen(void)
+ {
+ static const DWORD t_style[] = {
+ WS_OVERLAPPED, WS_POPUP, WS_CHILD, WS_THICKFRAME, WS_DLGFRAME
+ };
+ static const DWORD t_ex_style[] = {
+ 0, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW
+ };
+ WNDCLASS cls;
+ HWND hwnd;
+ int i, j;
+ POINT pt;
+ RECT rc;
+ HMONITOR hmon;
+ LRESULT ret;
+
+ if (!pGetMonitorInfoA || !pMonitorFromPoint)
+ {
+ win_skip("GetMonitorInfoA or MonitorFromPoint are not available on this platform\n");
+ return;
+ }
+
+ pt.x = pt.y = 0;
+ SetLastError(0xdeadbeef);
+ hmon = pMonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
+ ok(hmon != 0, "MonitorFromPoint error %u\n", GetLastError());
+
+ mi.cbSize = sizeof(mi);
+ SetLastError(0xdeadbeef);
+ ret = pGetMonitorInfoA(hmon, &mi);
+ ok(ret, "GetMonitorInfo error %u\n", GetLastError());
+ trace("monitor (%d,%d-%d,%d), work (%d,%d-%d,%d)\n",
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom);
+
+ cls.style = 0;
+ cls.lpfnWndProc = fullscreen_wnd_proc;
+ cls.cbClsExtra = 0;
+ cls.cbWndExtra = 0;
+ cls.hInstance = GetModuleHandle(0);
+ cls.hIcon = 0;
+ cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hbrBackground = GetStockObject(WHITE_BRUSH);
+ cls.lpszMenuName = NULL;
+ cls.lpszClassName = "fullscreen_class";
+ RegisterClass(&cls);
+
+ for (i = 0; i < sizeof(t_style)/sizeof(t_style[0]); i++)
+ {
+ DWORD style, ex_style;
+
+ /* avoid a WM interaction */
+ assert(!(t_style[i] & WS_VISIBLE));
+
+ for (j = 0; j < sizeof(t_ex_style)/sizeof(t_ex_style[0]); j++)
+ {
+ int fixup;
+
+ style = t_style[i];
+ ex_style = t_ex_style[j];
+
+ hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
+ GetWindowRect(hwnd, &rc);
+ trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
+ rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ DestroyWindow(hwnd);
+
+ style = t_style[i] | WS_MAXIMIZE;
+ hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
+ GetWindowRect(hwnd, &rc);
+ trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
+ rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ DestroyWindow(hwnd);
+
+ style = t_style[i] | WS_MAXIMIZE | WS_CAPTION;
+ hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
+ GetWindowRect(hwnd, &rc);
+ trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
+ rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ DestroyWindow(hwnd);
+
+ style = t_style[i] | WS_CAPTION | WS_MAXIMIZEBOX;
+ hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
+ GetWindowRect(hwnd, &rc);
+ trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
+ rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ DestroyWindow(hwnd);
+
+ style = t_style[i] | WS_MAXIMIZE | WS_CAPTION | WS_MAXIMIZEBOX;
+ hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
+ GetWindowRect(hwnd, &rc);
+ trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ /* Windows makes a maximized window slightly larger (to hide the borders?) */
+ fixup = min(abs(rc.left), abs(rc.top));
+ InflateRect(&rc, -fixup, -fixup);
+ ok(rc.left >= mi.rcWork.left && rc.top <= mi.rcWork.top &&
+ rc.right <= mi.rcWork.right && rc.bottom <= mi.rcWork.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d must be in %d,%d-%d,%d\n",
+ ex_style, style, rc.left, rc.top, rc.right, rc.bottom,
+ mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom);
+ DestroyWindow(hwnd);
+
+ style = t_style[i] | WS_MAXIMIZE | WS_MAXIMIZEBOX;
+ hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
+ mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
+ GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
+ GetWindowRect(hwnd, &rc);
+ trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ /* Windows makes a maximized window slightly larger (to hide the borders?) */
+ fixup = min(abs(rc.left), abs(rc.top));
+ InflateRect(&rc, -fixup, -fixup);
+ if (style & (WS_CHILD | WS_POPUP))
+ ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
+ rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
- else
++ else
+ ok(rc.left >= mi.rcWork.left && rc.top <= mi.rcWork.top &&
+ rc.right <= mi.rcWork.right && rc.bottom <= mi.rcWork.bottom,
+ "%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
+ DestroyWindow(hwnd);
+ }
+ }
+
+ UnregisterClass("fullscreen_class", GetModuleHandle(0));
+ }
+
+ static BOOL test_thick_child_got_minmax;
+ static const char * test_thick_child_name;
+ static LONG test_thick_child_style;
+ static LONG test_thick_child_exStyle;
+
+ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+ {
+ MINMAXINFO* minmax;
+ int expectedMinTrackX;
+ int expectedMinTrackY;
+ int actualMinTrackX;
+ int actualMinTrackY;
+ int expectedMaxTrackX;
+ int expectedMaxTrackY;
+ int actualMaxTrackX;
+ int actualMaxTrackY;
+ int expectedMaxSizeX;
+ int expectedMaxSizeY;
+ int actualMaxSizeX;
+ int actualMaxSizeY;
+ int expectedPosX;
+ int expectedPosY;
+ int actualPosX;
+ int actualPosY;
+ LONG adjustedStyle;
+ RECT rect;
+ switch (msg)
+ {
+ case WM_GETMINMAXINFO:
+ {
+ minmax = (MINMAXINFO *)lparam;
+ trace("hwnd %p, WM_GETMINMAXINFO, %08lx, %08lx\n", hwnd, wparam, lparam);
+ dump_minmax_info( minmax );
+
+ test_thick_child_got_minmax = TRUE;
+
+
+ adjustedStyle = test_thick_child_style;
+ if ((adjustedStyle & WS_CAPTION) == WS_CAPTION)
+ adjustedStyle &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
+ GetClientRect(GetParent(hwnd), &rect);
+ AdjustWindowRectEx(&rect, adjustedStyle, FALSE, test_thick_child_exStyle);
+
+ if (test_thick_child_style & (WS_DLGFRAME | WS_BORDER))
+ {
+ expectedMinTrackX = GetSystemMetrics(SM_CXMINTRACK);
+ expectedMinTrackY = GetSystemMetrics(SM_CYMINTRACK);
+ }
+ else
+ {
+ expectedMinTrackX = -2 * rect.left;
+ expectedMinTrackY = -2 * rect.top;
+ }
+ actualMinTrackX = minmax->ptMinTrackSize.x;
+ actualMinTrackY = minmax->ptMinTrackSize.y;
+
+ ok(actualMinTrackX == expectedMinTrackX && actualMinTrackY == expectedMinTrackY,
+ "expected minTrack %dx%d, actual minTrack %dx%d for %s\n",
+ expectedMinTrackX, expectedMinTrackY, actualMinTrackX, actualMinTrackY,
+ test_thick_child_name);
+
+ actualMaxTrackX = minmax->ptMaxTrackSize.x;
+ actualMaxTrackY = minmax->ptMaxTrackSize.y;
+ expectedMaxTrackX = GetSystemMetrics(SM_CXMAXTRACK);
+ expectedMaxTrackY = GetSystemMetrics(SM_CYMAXTRACK);
+ ok(actualMaxTrackX == expectedMaxTrackX && actualMaxTrackY == expectedMaxTrackY,
+ "expected maxTrack %dx%d, actual maxTrack %dx%d for %s\n",
+ expectedMaxTrackX, expectedMaxTrackY, actualMaxTrackX, actualMaxTrackY,
+ test_thick_child_name);
+
+ expectedMaxSizeX = rect.right - rect.left;
+ expectedMaxSizeY = rect.bottom - rect.top;
+ actualMaxSizeX = minmax->ptMaxSize.x;
+ actualMaxSizeY = minmax->ptMaxSize.y;
+
+ ok(actualMaxSizeX == expectedMaxSizeX && actualMaxSizeY == expectedMaxSizeY,
+ "expected maxSize %dx%d, actual maxSize %dx%d for %s\n",
+ expectedMaxSizeX, expectedMaxSizeY, actualMaxSizeX, actualMaxSizeY,
+ test_thick_child_name);
+
+
+ expectedPosX = rect.left;
+ expectedPosY = rect.top;
+ actualPosX = minmax->ptMaxPosition.x;
+ actualPosY = minmax->ptMaxPosition.y;
+ ok(actualPosX == expectedPosX && actualPosY == expectedPosY,
+ "expected maxPosition (%d/%d), actual maxPosition (%d/%d) for %s\n",
+ expectedPosX, expectedPosY, actualPosX, actualPosY, test_thick_child_name);
+
+ break;
+ }
+ }
+
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
+ }
+
+ #define NUMBER_OF_THICK_CHILD_TESTS 16
+ static void test_thick_child_size(HWND parentWindow)
+ {
+ BOOL success;
+ RECT childRect;
+ RECT adjustedParentRect;
+ HWND childWindow;
+ LONG childWidth;
+ LONG childHeight;
+ LONG expectedWidth;
+ LONG expectedHeight;
+ WNDCLASSA cls;
+ LPCTSTR className = "THICK_CHILD_CLASS";
+ int i;
+ LONG adjustedStyle;
+ static const LONG styles[NUMBER_OF_THICK_CHILD_TESTS] = {
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER,
+ WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER,
+ };
+
+ static const LONG exStyles[NUMBER_OF_THICK_CHILD_TESTS] = {
+ 0,
+ 0,
+ 0,
+ 0,
+ WS_EX_DLGMODALFRAME,
+ WS_EX_DLGMODALFRAME,
+ WS_EX_DLGMODALFRAME,
+ WS_EX_DLGMODALFRAME,
+ WS_EX_STATICEDGE,
+ WS_EX_STATICEDGE,
+ WS_EX_STATICEDGE,
+ WS_EX_STATICEDGE,
+ WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME,
+ WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME,
+ WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME,
+ WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME,
+ };
+ static const char *styleName[NUMBER_OF_THICK_CHILD_TESTS] = {
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME, exstyle= WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME exstyle= WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER exstyle= WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER exstyle= WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME exstyle= WS_EX_STATICEDGE",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME exstyle= WS_EX_STATICEDGE",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER exstyle= WS_EX_STATICEDGE",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER exstyle= WS_EX_STATICEDGE",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME, exstyle= WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME exstyle= WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME | WS_BORDER exstyle= WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME",
+ "style=WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_BORDER exstyle= WS_EX_STATICEDGE | WS_EX_DLGMODALFRAME",
+ };
+
+ cls.style = 0;
+ cls.lpfnWndProc = test_thick_child_size_winproc;
+ cls.cbClsExtra = 0;
+ cls.cbWndExtra = 0;
+ cls.hInstance = GetModuleHandleA(0);
+ cls.hIcon = 0;
+ cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hbrBackground = GetStockObject(WHITE_BRUSH);
+ cls.lpszMenuName = NULL;
+ cls.lpszClassName = className;
+ SetLastError(0xdeadbeef);
+ ok(RegisterClassA(&cls),"RegisterClassA failed, error: %u\n", GetLastError());
+
+ for(i = 0; i < NUMBER_OF_THICK_CHILD_TESTS; i++)
+ {
+ test_thick_child_name = styleName[i];
+ test_thick_child_style = styles[i];
+ test_thick_child_exStyle = exStyles[i];
+ test_thick_child_got_minmax = FALSE;
+
+ SetLastError(0xdeadbeef);
+ childWindow = CreateWindowEx( exStyles[i], className, "", styles[i], 0, 0, 0, 0, parentWindow, 0, GetModuleHandleA(0), NULL );
+ ok(childWindow != NULL, "Failed to create child window, error: %u\n", GetLastError());
+
+ ok(test_thick_child_got_minmax, "Got no WM_GETMINMAXINFO\n");
+
+ SetLastError(0xdeadbeef);
+ success = GetWindowRect(childWindow, &childRect);
+ ok(success,"GetWindowRect call failed, error: %u\n", GetLastError());
+ childWidth = childRect.right - childRect.left;
+ childHeight = childRect.bottom - childRect.top;
+
+ adjustedStyle = styles[i];
+ if ((adjustedStyle & WS_CAPTION) == WS_CAPTION)
+ adjustedStyle &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
+ GetClientRect(GetParent(childWindow), &adjustedParentRect);
+ AdjustWindowRectEx(&adjustedParentRect, adjustedStyle, FALSE, test_thick_child_exStyle);
+
+
+ if (test_thick_child_style & (WS_DLGFRAME | WS_BORDER))
+ {
+ expectedWidth = GetSystemMetrics(SM_CXMINTRACK);
+ expectedHeight = GetSystemMetrics(SM_CYMINTRACK);
}
- DestroyWindow(hwndMain);
+ else
+ {
+ expectedWidth = -2 * adjustedParentRect.left;
+ expectedHeight = -2 * adjustedParentRect.top;
+ }
+
+ ok((childWidth == expectedWidth) && (childHeight == expectedHeight),
+ "size of window (%s) is wrong: expected size %dx%d != actual size %dx%d\n",
+ test_thick_child_name, expectedWidth, expectedHeight, childWidth, childHeight);
+
+ SetLastError(0xdeadbeef);
+ success = DestroyWindow(childWindow);
+ ok(success,"DestroyWindow call failed, error: %u\n", GetLastError());
}
+ ok(UnregisterClass(className, GetModuleHandleA(0)),"UnregisterClass call failed\n");
+ }
+
+ static void test_handles( HWND full_hwnd )
+ {
+ HWND hwnd = full_hwnd;
+ BOOL ret;
+ RECT rect;
+
+ SetLastError( 0xdeadbeef );
+ ret = GetWindowRect( hwnd, &rect );
+ ok( ret, "GetWindowRect failed for %p err %u\n", hwnd, GetLastError() );
+
+ #ifdef _WIN64
+ if ((ULONG_PTR)full_hwnd >> 32)
+ hwnd = (HWND)((ULONG_PTR)full_hwnd & ~0u);
else
- trace("CreateWindowExA with parent HWND_MESSAGE failed\n");
+ hwnd = (HWND)((ULONG_PTR)full_hwnd | ((ULONG_PTR)~0u << 32));
+ SetLastError( 0xdeadbeef );
+ ret = GetWindowRect( hwnd, &rect );
+ ok( ret, "GetWindowRect failed for %p err %u\n", hwnd, GetLastError() );
+
+ hwnd = (HWND)(((ULONG_PTR)full_hwnd & ~0u) | ((ULONG_PTR)0x1234 << 32));
+ SetLastError( 0xdeadbeef );
+ ret = GetWindowRect( hwnd, &rect );
+ ok( ret, "GetWindowRect failed for %p err %u\n", hwnd, GetLastError() );
+
+ hwnd = (HWND)(((ULONG_PTR)full_hwnd & 0xffff) | ((ULONG_PTR)0x9876 << 16));
+ SetLastError( 0xdeadbeef );
+ ret = GetWindowRect( hwnd, &rect );
+ ok( !ret, "GetWindowRect succeeded for %p\n", hwnd );
+ ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+
+ hwnd = (HWND)(((ULONG_PTR)full_hwnd & 0xffff) | ((ULONG_PTR)0x12345678 << 16));
+ SetLastError( 0xdeadbeef );
+ ret = GetWindowRect( hwnd, &rect );
+ ok( !ret, "GetWindowRect succeeded for %p\n", hwnd );
+ ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+ #endif
+ }
+
+ static void test_winregion(void)
+ {
+ HWND hwnd;
+ RECT r;
+ int ret;
+ HRGN hrgn;
+
+ if (!pGetWindowRgnBox)
+ {
+ win_skip("GetWindowRgnBox not supported\n");
+ return;
+ }
+
+ hwnd = CreateWindowExA(0, "static", NULL, WS_VISIBLE, 10, 10, 10, 10, NULL, 0, 0, NULL);
+ /* NULL prect */
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowRgnBox(hwnd, NULL);
+ ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
+ ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", GetLastError());
+
+ hrgn = CreateRectRgn(2, 3, 10, 15);
+ ok( hrgn != NULL, "Region creation failed\n");
+ if (hrgn)
+ {
+ SetWindowRgn(hwnd, hrgn, FALSE);
+
+ SetLastError(0xdeadbeef);
+ ret = pGetWindowRgnBox(hwnd, NULL);
+ ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
+ ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", GetLastError());
+
+ r.left = r.top = r.right = r.bottom = 0;
+ ret = pGetWindowRgnBox(hwnd, &r);
+ ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got %d\n", ret);
+ ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15,
+ "Expected (2,3,10,15), got (%d,%d,%d,%d)\n", r.left, r.top,
+ r.right, r.bottom);
+ DeleteObject(hrgn);
+ }
+ DestroyWindow(hwnd);
+ }
+
+ START_TEST(win)
+ {
+ HMODULE user32 = GetModuleHandleA( "user32.dll" );
+ pGetAncestor = (void *)GetProcAddress( user32, "GetAncestor" );
+ pGetWindowInfo = (void *)GetProcAddress( user32, "GetWindowInfo" );
+ pGetWindowModuleFileNameA = (void *)GetProcAddress( user32, "GetWindowModuleFileNameA" );
+ pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" );
+ pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" );
+ pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
+ pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
+ pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
if (!RegisterWindowClasses()) assert(0);
/* Although Wine currently returns FALSE, the logic behind it is wrong. It is not a todo_wine though in the testing sense */
ok( bAppThemed == FALSE, "Expected FALSE as this test executable is not (yet) themed.\n");
- todo_wine
- ok( GetLastError() == ERROR_SUCCESS,
- "Expected ERROR_SUCCESS, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == ERROR_SUCCESS,
+ "Expected ERROR_SUCCESS, got 0x%08x\n",
+ GetLastError());
SetLastError(0xdeadbeef);
bTPDefined = pIsThemePartDefined(NULL, 0 , 0);
ok ( hFtp != NULL, "InternetConnect failed : %d\n", GetLastError());
ok ( GetLastError() == ERROR_SUCCESS,
"ERROR_SUCCESS, got %d\n", GetLastError());
- }
+
+ SetLastError(0xdeadbeef);
+ hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", NULL,
+ INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
+ if (!hFtp)
+ {
+ ok(GetLastError() == ERROR_INTERNET_LOGIN_FAILURE,
+ "Expected ERROR_INTERNET_LOGIN_FAILURE, got %d\n", GetLastError());
++}
+ else
+ {
+ ok(GetLastError() == ERROR_SUCCESS,
+ "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+ }
}
static void test_createdir(HINTERNET hFtp, HINTERNET hConnect)
* Test helper macros
*/
- #ifdef FIELD_ALIGNMENT
- # define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+ #ifdef _WIN64
+
+ # define TEST_TYPE_SIZE(type, size)
+ # define TEST_TYPE_ALIGN(type, align)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
+ # define TEST_FIELD_OFFSET(type, field, offset)
+
#else
- # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
- #endif
- #define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+ # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
- #ifdef _TYPE_ALIGNMENT
- #define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
+ # ifdef TYPE_ALIGNMENT
+ # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
-# else
+#else
- # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TYPE_ALIGN(type, align)
-# endif
+#endif
- #ifdef TYPE_ALIGNMENT
- #define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
+ # ifdef _TYPE_ALIGNMENT
+ # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
+ # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
-# else
+#else
- # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
+ # define TEST_TARGET_ALIGN(type, align)
+ # define TEST_FIELD_ALIGN(type, field, align)
-# endif
+#endif
- #define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
+ # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
- /***********************************************************************
- * Test macros
- */
-
- #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
- #define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
- #define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
+ #endif
- #define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
+ #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+ #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
+ #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+ #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
- #define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_GOPHER_ABSTRACT_ATTRIBUTE_TYPEA(void)
{
length = sizeof(buffer);
res = InternetQueryOptionA(hor, INTERNET_OPTION_URL, buffer, &length);
ok(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
- ok(!strcmp(buffer, "http://www.winehq.org/about/"), "Wrong URL %s\n", buffer);
+ ok(!strcmp(buffer, "http://test.winehq.org/testredirect"), "Wrong URL %s\n", buffer);
+
+ length = sizeof(buffer);
+ res = HttpQueryInfoA(hor, HTTP_QUERY_RAW_HEADERS, buffer, &length, 0x0);
+ ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
+ ok(length == 0, "HTTP_QUERY_RAW_HEADERS: expected length 0, but got %d\n", length);
+ ok(!strcmp(buffer, ""), "HTTP_QUERY_RAW_HEADERS: expected string \"\", but got \"%s\"\n", buffer);
CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
- todo_wine
- {
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
- }
if (first_connection_to_test_url)
{
SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);
if (hor == 0x0) goto abort;
CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
- todo_wine
- {
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
- }
if (first_connection_to_test_url)
{
SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);
CHECK_NOT_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
if (inetbuffers.dwBufferLength)
{
- CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
- CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
+ todo_wine {
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
- }
++ }
}
else
{
Sleep(100);
CHECK_NOTIFIED2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0));
}
- if (hor != 0x0) todo_wine
- {
+ /* to enable once Wine is fixed to never send it
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+ CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
- }
- else
- {
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
- CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
- }
+ */
+ CLEAR_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+ CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
CloseHandle(hCompleteEvent);
first_connection_to_test_url = FALSE;
}
strcpy(buffer,"Warning");
ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
-
+ /* Ensure that blank headers are ignored and don't cause a failure */
+ ok(HttpAddRequestHeaders(hRequest,"\r\nBlankTest:value\r\n\r\n",-1, HTTP_ADDREQ_FLAG_ADD_IF_NEW), "Failed to add header with blank entries in list\n");
+
+ index = 0;
+ len = sizeof(buffer);
+ strcpy(buffer,"BlankTest");
+ ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+ ok(index == 1, "Index was not incremented\n");
+ ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
+
ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
done:
ok(InternetCloseHandle(hConnect), "Close connect handle failed\n");
START_TEST(internet)
{
- test_InternetCanonicalizeUrlA();
- test_InternetQueryOptionA();
- test_get_cookie();
+ HMODULE hdll;
+ hdll = GetModuleHandleA("wininet.dll");
+ pCreateUrlCacheContainerA = (void*)GetProcAddress(hdll, "CreateUrlCacheContainerA");
+ pCreateUrlCacheContainerW = (void*)GetProcAddress(hdll, "CreateUrlCacheContainerW");
+ pInternetTimeFromSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeA");
+ pInternetTimeFromSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeW");
+ pInternetTimeToSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeA");
+ pInternetTimeToSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeW");
+ pIsDomainLegalCookieDomainW = (void*)GetProcAddress(hdll, (LPCSTR)117);
+
- test_version();
- test_null();
+ test_InternetCanonicalizeUrlA();
+ test_InternetQueryOptionA();
+ test_get_cookie();
+ test_complicated_cookie();
- }
+ test_version();
+ test_null();
+
+ if (!pInternetTimeFromSystemTimeA)
+ win_skip("skipping the InternetTime tests\n");
+ else
+ {
+ InternetTimeFromSystemTimeA_test();
+ InternetTimeFromSystemTimeW_test();
+ InternetTimeToSystemTimeA_test();
+ InternetTimeToSystemTimeW_test();
++}
+ if (pIsDomainLegalCookieDomainW &&
+ ((void*)pIsDomainLegalCookieDomainW == (void*)pCreateUrlCacheContainerA ||
+ (void*)pIsDomainLegalCookieDomainW == (void*)pCreateUrlCacheContainerW))
+ win_skip("IsDomainLegalCookieDomainW is not available on systems with IE5\n");
+ else if (!pIsDomainLegalCookieDomainW)
+ win_skip("IsDomainLegalCookieDomainW (or ordinal 117) is not available\n");
+ else
+ test_IsDomainLegalCookieDomainW();
}
SetLastError(0xdeadbeef);
r = InternetCrackUrlW(NULL, 0, 0, &comp );
error = GetLastError();
+ if (!r && error == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ win_skip("InternetCrackUrlW is not implemented\n");
+ return;
+ }
ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
- ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error);
+ ok( error == ERROR_INVALID_PARAMETER ||
+ broken(error == ERROR_INTERNET_UNRECOGNIZED_SCHEME), /* IE5 */
+ "expected ERROR_INVALID_PARAMETER got %u\n", error);
- SetLastError(0xdeadbeef);
- r = InternetCrackUrlW(url, 0, 0, NULL );
- error = GetLastError();
- ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
- ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error);
+ if (error == ERROR_INVALID_PARAMETER)
+ {
+ /* Crashes on IE5 */
+ SetLastError(0xdeadbeef);
+ r = InternetCrackUrlW(url, 0, 0, NULL );
+ error = GetLastError();
+ ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
+ ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error);
+ }
r = InternetCrackUrlW(url, 0, 0, &comp );
ok( r, "failed to crack url\n");