Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2017
- 68 participants
- 738 messages
[PATCH 2/4] explorer: Use the class name ExplorerWClass for the explorer browser.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
programs/explorer/explorer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c
index 9590027..3571497 100644
--- a/programs/explorer/explorer.c
+++ b/programs/explorer/explorer.c
@@ -51,7 +51,7 @@ static int default_width;
static int default_height;
-static const WCHAR EXPLORER_CLASS[] = {'W','I','N','E','_','E','X','P','L','O','R','E','R','\0'};
+static const WCHAR EXPLORER_CLASS[] = {'E','x','p','l','o','r','e','r','W','C','l','a','s','s',0};
static const WCHAR PATH_BOX_NAME[] = {'\0'};
HINSTANCE explorer_hInstance;
--
2.7.4
Nov. 29, 2017
[PATCH 1/4] shell32/tests: Simplify and standardize test structure for progman_dde.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/shell32/tests/progman_dde.c | 577 ++++++++++-----------------------------
1 file changed, 138 insertions(+), 439 deletions(-)
diff --git a/dlls/shell32/tests/progman_dde.c b/dlls/shell32/tests/progman_dde.c
index 6e1378f..6be7267 100644
--- a/dlls/shell32/tests/progman_dde.c
+++ b/dlls/shell32/tests/progman_dde.c
@@ -34,25 +34,6 @@
#include "winuser.h"
#include "shlobj.h"
-/* Timeout on DdeClientTransaction Call */
-#define MS_TIMEOUT_VAL 1000
-/* # of times to poll for window creation */
-#define PDDE_POLL_NUM 150
-/* time to sleep between polls */
-#define PDDE_POLL_TIME 300
-
-/* Call Info */
-#define DDE_TEST_MISC 0x00010000
-#define DDE_TEST_CREATEGROUP 0x00020000
-#define DDE_TEST_DELETEGROUP 0x00030000
-#define DDE_TEST_SHOWGROUP 0x00040000
-#define DDE_TEST_ADDITEM 0x00050000
-#define DDE_TEST_DELETEITEM 0x00060000
-#define DDE_TEST_COMPOUND 0x00070000
-#define DDE_TEST_CALLMASK 0x00ff0000
-
-#define DDE_TEST_NUMMASK 0x0000ffff
-
static HRESULT (WINAPI *pSHGetLocalizedName)(LPCWSTR, LPWSTR, UINT, int *);
static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
static BOOL (WINAPI *pReadCabinetState)(CABINETSTATE *, int);
@@ -231,411 +212,64 @@ static HDDEDATA CALLBACK DdeCallback(UINT type, UINT format, HCONV hConv, HSZ hs
return NULL;
}
-/*
- * Encoded String for Error Messages so that inner failures can determine
- * what test is failing. Format is: [Code:TestNum]
- */
-static const char * GetStringFromTestParams(int testParams)
-{
- int testNum;
- static char testParamString[64];
- const char *callId;
-
- testNum = testParams & DDE_TEST_NUMMASK;
- switch (testParams & DDE_TEST_CALLMASK)
- {
- default:
- case DDE_TEST_MISC:
- callId = "MISC";
- break;
- case DDE_TEST_CREATEGROUP:
- callId = "C_G";
- break;
- case DDE_TEST_DELETEGROUP:
- callId = "D_G";
- break;
- case DDE_TEST_SHOWGROUP:
- callId = "S_G";
- break;
- case DDE_TEST_ADDITEM:
- callId = "A_I";
- break;
- case DDE_TEST_DELETEITEM:
- callId = "D_I";
- break;
- case DDE_TEST_COMPOUND:
- callId = "CPD";
- break;
- }
-
- sprintf(testParamString, " [%s:%i]", callId, testNum);
- return testParamString;
-}
-
-/* Transfer DMLERR's into text readable strings for Error Messages */
-#define DMLERR_TO_STR(x) case x: return#x;
-static const char * GetStringFromError(UINT err)
+static UINT dde_execute(DWORD instance, HCONV hconv, const char *command_str)
{
- switch (err)
- {
- DMLERR_TO_STR(DMLERR_NO_ERROR);
- DMLERR_TO_STR(DMLERR_ADVACKTIMEOUT);
- DMLERR_TO_STR(DMLERR_BUSY);
- DMLERR_TO_STR(DMLERR_DATAACKTIMEOUT);
- DMLERR_TO_STR(DMLERR_DLL_NOT_INITIALIZED);
- DMLERR_TO_STR(DMLERR_DLL_USAGE);
- DMLERR_TO_STR(DMLERR_EXECACKTIMEOUT);
- DMLERR_TO_STR(DMLERR_INVALIDPARAMETER);
- DMLERR_TO_STR(DMLERR_LOW_MEMORY);
- DMLERR_TO_STR(DMLERR_MEMORY_ERROR);
- DMLERR_TO_STR(DMLERR_NOTPROCESSED);
- DMLERR_TO_STR(DMLERR_NO_CONV_ESTABLISHED);
- DMLERR_TO_STR(DMLERR_POKEACKTIMEOUT);
- DMLERR_TO_STR(DMLERR_POSTMSG_FAILED);
- DMLERR_TO_STR(DMLERR_REENTRANCY);
- DMLERR_TO_STR(DMLERR_SERVER_DIED);
- DMLERR_TO_STR(DMLERR_SYS_ERROR);
- DMLERR_TO_STR(DMLERR_UNADVACKTIMEOUT);
- DMLERR_TO_STR(DMLERR_UNFOUND_QUEUE_ID);
- default:
- return "Unknown DML Error";
- }
-}
+ HDDEDATA command, hdata;
+ DWORD result;
+ UINT ret;
-/* Helper Function to Transfer DdeGetLastError into a String */
-static const char * GetDdeLastErrorStr(DWORD instance)
-{
- UINT err = DdeGetLastError(instance);
+ command = DdeCreateDataHandle(instance, (BYTE *)command_str, strlen(command_str)+1, 0, 0, 0, 0);
+ ok(command != NULL, "DdeCreateDataHandle() failed: %u\n", DdeGetLastError(instance));
- return GetStringFromError(err);
-}
+ hdata = DdeClientTransaction((BYTE *)command, -1, hconv, 0, 0, XTYP_EXECUTE, 2000, &result);
+ ret = DdeGetLastError(instance);
+ /* PROGMAN always returns 1 on success */
+ ok((UINT)hdata == !ret, "expected %o, got %p\n", !ret, hdata);
-/* Execute a Dde Command and return the error & result */
-/* Note: Progman DDE always returns a pointer to 0x00000001 on a successful result */
-static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, HDDEDATA *hData, UINT *err, int testParams)
-{
- HDDEDATA command;
-
- command = DdeCreateDataHandle(instance, (LPBYTE) strCmd, strlen(strCmd)+1, 0, 0L, 0, 0);
- ok (command != NULL, "DdeCreateDataHandle Error %s.%s\n",
- GetDdeLastErrorStr(instance), GetStringFromTestParams(testParams));
- *hData = DdeClientTransaction((void *) command,
- -1,
- hConv,
- 0,
- 0,
- XTYP_EXECUTE,
- MS_TIMEOUT_VAL,
- NULL);
-
- /* hData is technically a pointer, but for Program Manager,
- * it is NULL (error) or 1 (success)
- * TODO: Check other versions of Windows to verify 1 is returned.
- * While it is unlikely that anyone is actually testing that the result is 1
- * if all versions of windows return 1, Wine should also.
- */
- if (*hData == NULL)
- {
- *err = DdeGetLastError(instance);
- }
- else
- {
- *err = DMLERR_NO_ERROR;
- todo_wine
- {
- ok(*hData == (HDDEDATA) 1, "Expected HDDEDATA Handle == 1, actually %p.%s\n",
- *hData, GetStringFromTestParams(testParams));
- }
- }
- DdeFreeDataHandle(command);
+ return ret;
}
-/*
- * Check if Window is onscreen with the appropriate name.
- *
- * Windows are not created synchronously. So we do not know
- * when and if the window will be created/shown on screen.
- * This function implements a polling mechanism to determine
- * creation.
- * A more complicated method would be to use SetWindowsHookEx.
- * Since polling worked fine in my testing, no reason to implement
- * the other. Comments about other methods of determining when
- * window creation happened were not encouraging (not including
- * SetWindowsHookEx).
- */
-static HWND CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams)
+static BOOL check_window_exists(const char *name)
{
HWND window = NULL;
int i;
- /* Poll for Window Creation */
- for (i = 0; window == NULL && i < PDDE_POLL_NUM; i++)
- {
- Sleep(PDDE_POLL_TIME);
- /* Specify the window class name to make sure what we find is really an
- * Explorer window. Explorer used two different window classes so try
- * both.
- */
- window = FindWindowA("ExplorerWClass", winName);
- if (!window)
- window = FindWindowA("CabinetWClass", winName);
- }
- ok (window != NULL, "Window \"%s\" was not created in %i seconds - assumed failure.%s\n",
- winName, PDDE_POLL_NUM*PDDE_POLL_TIME/1000, GetStringFromTestParams(testParams));
-
- /* Close Window as desired. */
- if (window != NULL && closeWindow)
- {
- SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
- window = NULL;
- }
- return window;
-}
-
-/* Check for Existence (or non-existence) of a file or group
- * When testing for existence of a group, groupName is not needed
- */
-static void CheckFileExistsInProgramGroups(const char *nameToCheck, BOOL shouldExist, BOOL isGroup,
- const char *groupName, int testParams)
-{
- char path[MAX_PATH];
- DWORD attributes;
- int len;
-
- lstrcpyA(path, ProgramsDir);
-
- len = strlen(path) + strlen(nameToCheck)+1;
- if (groupName != NULL)
+ for (i = 0; i < 20; i++)
{
- len += strlen(groupName)+1;
- }
- ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams));
- if (len <= MAX_PATH)
- {
- if (groupName != NULL)
- {
- strcat(path, "\\");
- strcat(path, groupName);
- }
- strcat(path, "\\");
- strcat(path, nameToCheck);
- attributes = GetFileAttributesA(path);
- if (!shouldExist)
+ Sleep(100);
+ if ((window = FindWindowA("ExplorerWClass", name)) ||
+ (window = FindWindowA("CabinetWClass", name)))
{
- ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
- path, GetStringFromTestParams(testParams));
- } else {
- if (attributes == INVALID_FILE_ATTRIBUTES)
- {
- ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams));
- } else if (isGroup) {
- ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n",
- path, attributes, GetStringFromTestParams(testParams));
- } else {
- ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n",
- path, attributes, GetStringFromTestParams(testParams));
- }
+ SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
+ break;
}
}
-}
-
-/* Create Group Test.
- * command and expected_result.
- * if expected_result is DMLERR_NO_ERROR, test
- * 1. group was created
- * 2. window is open
- */
-static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
- const char *groupName, const char *windowTitle, int testParams)
-{
- HDDEDATA hData;
- UINT error;
-
- /* Execute Command & Check Result */
- DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
- todo_wine
- {
- ok (expected_result == error, "CreateGroup %s: Expected Error %s, received %s.%s\n",
- groupName, GetStringFromError(expected_result), GetStringFromError(error),
- GetStringFromTestParams(testParams));
- }
-
- /* No Error */
- if (error == DMLERR_NO_ERROR)
- {
-
- /* Check if Group Now Exists */
- CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
- /* Check if Window is Open (polling) */
- CheckWindowCreated(windowTitle, TRUE, testParams);
- }
-}
-
-/* Show Group Test.
- * DDE command, expected_result, and the group name to check for existence
- * if expected_result is DMLERR_NO_ERROR, test
- * 1. window is open
- */
-static HWND ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
- const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams)
-{
- HDDEDATA hData;
- UINT error;
- HWND hwnd = 0;
-
- DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
-/* todo_wine... Is expected to fail, wine stubbed functions DO fail */
-/* TODO REMOVE THIS CODE!!! */
- todo_wine_if (expected_result != DMLERR_NOTPROCESSED)
- ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n",
- groupName, GetStringFromError(expected_result), GetStringFromError(error),
- GetStringFromTestParams(testParams));
- if (error == DMLERR_NO_ERROR)
- {
- /* Check if Window is Open (polling) */
- hwnd = CheckWindowCreated(windowTitle, closeAfterShowing, testParams);
- }
- return hwnd;
+ return (window != NULL);
}
-/* Delete Group Test.
- * DDE command, expected_result, and the group name to check for existence
- * if expected_result is DMLERR_NO_ERROR, test
- * 1. group does not exist
- */
-static void DeleteGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
- const char *groupName, int testParams)
+static BOOL check_exists(const char *name)
{
- HDDEDATA hData;
- UINT error;
-
- DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
- todo_wine
- {
- ok (expected_result == error, "DeleteGroup %s: Expected Error %s, received %s.%s\n",
- groupName, GetStringFromError(expected_result), GetStringFromError(error),
- GetStringFromTestParams(testParams));
- }
-
- if (error == DMLERR_NO_ERROR)
- {
- /* Check that Group does not exist */
- CheckFileExistsInProgramGroups(groupName, FALSE, TRUE, NULL, testParams);
- }
-}
-
-/* Add Item Test
- * DDE command, expected result, and group and file name where it should exist.
- * checks to make sure error code matches expected error code
- * checks to make sure item exists if successful
- */
-static void AddItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
- const char *fileName, const char *groupName, int testParams)
-{
- HDDEDATA hData;
- UINT error;
-
- DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
- todo_wine
- {
- ok (expected_result == error, "AddItem %s: Expected Error %s, received %s.%s\n",
- fileName, GetStringFromError(expected_result), GetStringFromError(error),
- GetStringFromTestParams(testParams));
- }
-
- if (error == DMLERR_NO_ERROR)
- {
- /* Check that File exists */
- CheckFileExistsInProgramGroups(fileName, TRUE, FALSE, groupName, testParams);
- }
-}
-
-/* Delete Item Test.
- * DDE command, expected result, and group and file name where it should exist.
- * checks to make sure error code matches expected error code
- * checks to make sure item does not exist if successful
- */
-static void DeleteItemTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
- const char *fileName, const char *groupName, int testParams)
-{
- HDDEDATA hData;
- UINT error;
-
- DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
- todo_wine
- {
- ok (expected_result == error, "DeleteItem %s: Expected Error %s, received %s.%s\n",
- fileName, GetStringFromError(expected_result), GetStringFromError(error),
- GetStringFromTestParams(testParams));
- }
-
- if (error == DMLERR_NO_ERROR)
- {
- /* Check that File does not exist */
- CheckFileExistsInProgramGroups(fileName, FALSE, FALSE, groupName, testParams);
- }
-}
-
-/* Compound Command Test.
- * not really generic, assumes command of the form:
- * [CreateGroup ...][AddItem ...][AddItem ...]
- * All samples I've seen using Compound were of this form (CreateGroup,
- * AddItems) so this covers minimum expected functionality.
- */
-static HWND CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
- const char *groupName, const char *windowTitle, const char *fileName1,
- const char *fileName2, int testParams)
-{
- HDDEDATA hData;
- UINT error;
- HWND hwnd = 0;
-
- DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
- todo_wine
- {
- ok (expected_result == error, "Compound String %s: Expected Error %s, received %s.%s\n",
- command, GetStringFromError(expected_result), GetStringFromError(error),
- GetStringFromTestParams(testParams));
- }
-
- if (error == DMLERR_NO_ERROR)
- {
- /* Check that File exists */
- CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
- hwnd = CheckWindowCreated(windowTitle, FALSE, testParams);
- CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams);
- CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams);
- }
- return hwnd;
-}
+ char path[MAX_PATH];
-static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name)
-{
- lstrcpyA(itemtext, "[AddItem(");
- lstrcatA(itemtext, cmdline);
- lstrcatA(itemtext, ",");
- lstrcatA(itemtext, name);
- lstrcatA(itemtext, ")]");
+ strcpy(path, ProgramsDir);
+ strcat(path, "\\");
+ strcat(path, name);
+ return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
}
/* 1st set of tests */
-static int DdeTestProgman(DWORD instance, HCONV hConv)
+static void test_progman_dde(DWORD instance, HCONV hConv)
{
- HDDEDATA hData;
UINT error;
- int testnum;
char temppath[MAX_PATH];
char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH];
char itemtext[MAX_PATH + 20];
char comptext[2 * (MAX_PATH + 20) + 21];
- HWND hwnd;
- testnum = 1;
/* Invalid Command */
- DdeExecuteCommand(instance, hConv, "[InvalidCommand()]", &hData, &error, DDE_TEST_MISC|testnum++);
- ok (error == DMLERR_NOTPROCESSED, "InvalidCommand(), expected error %s, received %s.\n",
- GetStringFromError(DMLERR_NOTPROCESSED), GetStringFromError(error));
+ error = dde_execute(instance, hConv, "[InvalidCommand()]");
+ ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
/* On Vista+ the files have to exist when adding a link */
GetTempPathA(MAX_PATH, temppath);
@@ -646,38 +280,96 @@ static int DdeTestProgman(DWORD instance, HCONV hConv)
GetTempFileNameA(temppath, "dde", 0, f2g3);
/* CreateGroup Tests (including AddItem, DeleteItem) */
- CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++);
- CreateAddItemText(itemtext, f1g1, "f1g1Name");
- AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f1g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
- CreateAddItemText(itemtext, f2g1, "f2g1Name");
- AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
- DeleteItemTest(instance, hConv, "[DeleteItem(f2g1Name)]", DMLERR_NO_ERROR, "f2g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
- CreateAddItemText(itemtext, f3g1, "f3g1Name");
- AddItemTest(instance, hConv, itemtext, DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_ADDITEM|testnum++);
- CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++);
+ error = dde_execute(instance, hConv, "[CreateGroup(Group1)]");
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group1"), "directory not created\n");
+ ok(check_window_exists(Group1Title), "window not created\n");
+ }
+
+ sprintf(itemtext, "[AddItem(%s,f1g1Name)]", f1g1);
+ error = dde_execute(instance, hConv, itemtext);
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group1/f1g1Name.lnk"), "link not created\n");
+ }
+
+ sprintf(itemtext, "[AddItem(%s,f2g1Name)]", f2g1);
+ error = dde_execute(instance, hConv, itemtext);
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group1/f2g1Name.lnk"), "link not created\n");
+ }
+
+ error = dde_execute(instance, hConv, "[DeleteItem(f2g1Name)]");
+ todo_wine
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(!check_exists("Group1/f2g1Name.lnk"), "link should not exist\n");
+
+ sprintf(itemtext, "[AddItem(%s,f3g1Name)]", f3g1);
+ error = dde_execute(instance, hConv, itemtext);
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group1/f3g1Name.lnk"), "link not created\n");
+ }
+
+ error = dde_execute(instance, hConv, "[CreateGroup(Group2)]");
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group2"), "directory not created\n");
+ ok(check_window_exists(Group2Title), "window not created\n");
+ }
+
/* Create Group that already exists - same instance */
- CreateGroupTest(instance, hConv, "[CreateGroup(Group1)]", DMLERR_NO_ERROR, "Group1", Group1Title, DDE_TEST_CREATEGROUP|testnum++);
+ error = dde_execute(instance, hConv, "[CreateGroup(Group1)]");
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group1"), "directory not created\n");
+ ok(check_window_exists(Group1Title), "window not created\n");
+ }
/* ShowGroup Tests */
- ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, "Group1", Group1Title, TRUE, DDE_TEST_SHOWGROUP|testnum++);
- DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
- ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, "Startup", StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++);
- hwnd = ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++);
+ error = dde_execute(instance, hConv, "[ShowGroup(Group1)]");
+ ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
- /* DeleteGroup Test - Note that Window is Open for this test */
- DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++);
- if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+ error = dde_execute(instance, hConv, "[DeleteItem(f3g1Name)]");
+ todo_wine
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(!check_exists("Group1/f3g1Name.lnk"), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[ShowGroup(Startup, 0)]");
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_window_exists(StartupTitle), "window not created\n");
+ }
+
+ error = dde_execute(instance, hConv, "[ShowGroup(Group1, 0)]");
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_window_exists(Group1Title), "window not created\n");
+ }
+
+ /* DeleteGroup Test */
+ error = dde_execute(instance, hConv, "[DeleteGroup(Group1)]");
+ todo_wine
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(!check_exists("Group1"), "directory should not exist\n");
/* Compound Execute String Command */
- lstrcpyA(comptext, "[CreateGroup(Group3)]");
- CreateAddItemText(itemtext, f1g3, "f1g3Name");
- lstrcatA(comptext, itemtext);
- CreateAddItemText(itemtext, f2g3, "f2g3Name");
- lstrcatA(comptext, itemtext);
- hwnd = CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMPOUND|testnum++);
+ sprintf(comptext, "[CreateGroup(Group3)][AddItem(%s,f1g3Name)][AddItem(%s,f2g3Name)]", f1g3, f2g3);
+ error = dde_execute(instance, hConv, comptext);
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group3"), "directory not created\n");
+ ok(check_window_exists(Group3Title), "window not created\n");
+ ok(check_exists("Group3/f1g3Name.lnk"), "link not created\n");
+ ok(check_exists("Group3/f2g3Name.lnk"), "link not created\n");
+ }
- DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++);
- if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+ error = dde_execute(instance, hConv, "[DeleteGroup(Group3)]");
+ todo_wine
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(!check_exists("Group3"), "directory should not exist\n");
/* Full Parameters of Add Item */
/* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */
@@ -687,16 +379,25 @@ static int DdeTestProgman(DWORD instance, HCONV hConv)
DeleteFileA(f3g1);
DeleteFileA(f1g3);
DeleteFileA(f2g3);
-
- return testnum;
}
/* 2nd set of tests - 2nd connection */
-static void DdeTestProgman2(DWORD instance, HCONV hConv, int testnum)
+static void test_progman_dde2(DWORD instance, HCONV hConv)
{
+ UINT error;
+
/* Create Group that already exists on a separate connection */
- CreateGroupTest(instance, hConv, "[CreateGroup(Group2)]", DMLERR_NO_ERROR, "Group2", Group2Title, DDE_TEST_CREATEGROUP|testnum++);
- DeleteGroupTest(instance, hConv, "[DeleteGroup(Group2)]", DMLERR_NO_ERROR, "Group2", DDE_TEST_DELETEGROUP|testnum++);
+ error = dde_execute(instance, hConv, "[CreateGroup(Group2)]");
+ todo_wine {
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(check_exists("Group2"), "directory not created\n");
+ ok(check_window_exists(Group2Title), "window not created\n");
+ }
+
+ error = dde_execute(instance, hConv, "[DeleteGroup(Group2)]");
+ todo_wine
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
+ ok(!check_exists("Group2"), "directory should not exist\n");
}
START_TEST(progman_dde)
@@ -705,20 +406,19 @@ START_TEST(progman_dde)
UINT err;
HSZ hszProgman;
HCONV hConv;
- int testnum;
init_function_pointers();
init_strings();
/* Initialize DDE Instance */
err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
- ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
+ ok(err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err);
/* Create Connection */
hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
- ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
+ ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
- ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
+ ok(DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
/* Seeing failures on early versions of Windows Connecting to progman, exit if connection fails */
if (hConv == NULL)
{
@@ -726,30 +426,29 @@ START_TEST(progman_dde)
return;
}
- /* Run Tests */
- testnum = DdeTestProgman(instance, hConv);
+ test_progman_dde(instance, hConv);
/* Cleanup & Exit */
- ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
- ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
+ ok(DdeDisconnect(hConv), "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
+ ok(DdeUninitialize(instance), "DdeUninitialize() failed: %u\n", DdeGetLastError(instance));
/* 2nd Instance (Followup Tests) */
/* Initialize DDE Instance */
instance = 0;
err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
- ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
+ ok (err == DMLERR_NO_ERROR, "DdeInitialize() failed: %u\n", err);
/* Create Connection */
hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
- ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
+ ok(hszProgman != NULL, "DdeCreateStringHandle() failed: %u\n", DdeGetLastError(instance));
hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
- ok (hConv != NULL, "DdeConnect Error %s\n", GetDdeLastErrorStr(instance));
- ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
+ ok(hConv != NULL, "DdeConnect() failed: %u\n", DdeGetLastError(instance));
+ ok(DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle() failed: %u\n", DdeGetLastError(instance));
/* Run Tests */
- DdeTestProgman2(instance, hConv, testnum);
+ test_progman_dde2(instance, hConv);
/* Cleanup & Exit */
- ok (DdeDisconnect(hConv), "DdeDisonnect Error %s\n", GetDdeLastErrorStr(instance));
- ok (DdeUninitialize(instance), "DdeUninitialize failed\n");
+ ok(DdeDisconnect(hConv), "DdeDisonnect() failed: %u\n", DdeGetLastError(instance));
+ ok(DdeUninitialize(instance), "DdeUninitialize() failed: %u\n", DdeGetLastError(instance));
}
--
2.7.4
Nov. 29, 2017
[PATCH] msvcrt: Set errno when close() is called on already closed fd
by Piotr Caban
Based on a patch by Olly Betts.
For bug #43902.
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcrt/file.c | 2 +-
dlls/msvcrt/tests/file.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
Nov. 28, 2017
[PATCH] msvcp90: Use correct locale in basic_ios::narrow and basic_ios::widen
by Piotr Caban
For bug #43905
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcp90/ios.c | 8 ++++----
dlls/msvcp90/tests/ios.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 4 deletions(-)
Nov. 28, 2017
Re: [PATCH 2/2] ole32: Add DIB saving in data cache, and relevant tests.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
Nov. 28, 2017
Re: [PATCH 1/2] ole32/tests: Add some tests for testing metafiles.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
Nov. 28, 2017
[PATCH 2/2] ole32: Add DIB saving in data cache, and relevant tests.
by Sergio Gómez Del Real
Signed-off-by: Sergio Gómez Del Real <sdelreal(a)codeweavers.com>
---
dlls/ole32/datacache.c | 49 ++++++++++++++++++++++++++++++++++++++++++-------
dlls/ole32/tests/ole2.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 7 deletions(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 0256957419..30cc7f27d9 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -838,6 +838,29 @@ static HRESULT DataCacheEntry_Save(DataCacheEntry *cache_entry, IStorage *storag
}
break;
}
+ case CF_DIB:
+ {
+ header.dwSize = GlobalSize(cache_entry->stgmedium.u.hGlobal);
+ if (header.dwSize)
+ {
+ const BITMAPINFO *bmi = GlobalLock(cache_entry->stgmedium.u.hGlobal);
+ /* Size in units of 0.01mm (ie. MM_HIMETRIC) */
+ if (bmi->bmiHeader.biXPelsPerMeter != 0 && bmi->bmiHeader.biYPelsPerMeter != 0)
+ {
+ header.dwObjectExtentX = bmi->bmiHeader.biWidth * 100000 / bmi->bmiHeader.biXPelsPerMeter;
+ header.dwObjectExtentY = bmi->bmiHeader.biHeight * 100000 / bmi->bmiHeader.biYPelsPerMeter;
+ }
+ else
+ {
+ HDC hdc = GetDC(0);
+ header.dwObjectExtentX = bmi->bmiHeader.biWidth * 2540 / GetDeviceCaps(hdc, LOGPIXELSX);
+ header.dwObjectExtentY = bmi->bmiHeader.biHeight * 2540 / GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(0, hdc);
+ }
+ GlobalUnlock(cache_entry->stgmedium.u.hGlobal);
+ }
+ break;
+ }
default:
break;
}
@@ -866,20 +889,32 @@ static HRESULT DataCacheEntry_Save(DataCacheEntry *cache_entry, IStorage *storag
IStream_Release(pres_stream);
return DV_E_STGMEDIUM;
}
- data = HeapAlloc(GetProcessHeap(), 0, header.dwSize);
- GetMetaFileBitsEx(mfpict->hMF, header.dwSize, data);
- GlobalUnlock(cache_entry->stgmedium.u.hMetaFilePict);
+ if (header.dwSize)
+ {
+ data = HeapAlloc(GetProcessHeap(), 0, header.dwSize);
+ GetMetaFileBitsEx(mfpict->hMF, header.dwSize, data);
+ GlobalUnlock(cache_entry->stgmedium.u.hMetaFilePict);
+ if (data)
+ {
+ hr = IStream_Write(pres_stream, data, header.dwSize, NULL);
+ HeapFree(GetProcessHeap(), 0, data);
+ }
+ }
}
break;
}
+ case CF_DIB:
+ {
+ data = GlobalLock(cache_entry->stgmedium.u.hGlobal);
+ if (header.dwSize)
+ hr = IStream_Write(pres_stream, data, header.dwSize, NULL);
+ GlobalUnlock(cache_entry->stgmedium.u.hGlobal);
+ break;
+ }
default:
break;
}
- if (data)
- hr = IStream_Write(pres_stream, data, header.dwSize, NULL);
- HeapFree(GetProcessHeap(), 0, data);
-
IStream_Release(pres_stream);
return hr;
}
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index 59a0fe172f..88ad207521 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -4092,6 +4092,12 @@ static IStorage *create_storage_from_def(const struct storage_def *stg_def)
return stg;
}
+static const BYTE dib_inf[] =
+{
+ 0x42, 0x4d, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x36, 0x00, 0x00, 0x00
+};
+
static const BYTE mf_rec[] =
{
0xd7, 0xcd, 0xc6, 0x9a, 0x00, 0x00, 0x00, 0x00,
@@ -4107,6 +4113,23 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st
switch (cf)
{
+ case CF_DIB:
+ data_size = sizeof(dib);
+ if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
+ {
+ data_size += sizeof(dib_inf);
+ data = HeapAlloc(GetProcessHeap(), 0, data_size);
+ memcpy(data, dib_inf, sizeof(dib_inf));
+ memcpy(data + sizeof(dib_inf), dib, sizeof(dib));
+ }
+ else
+ {
+ data = HeapAlloc(GetProcessHeap(), 0, data_size);
+ memcpy(data, dib, sizeof(dib));
+ }
+ stg_def->stream[stm_idx].data = data;
+ stg_def->stream[stm_idx].data_size = data_size;
+ break;
case CF_METAFILEPICT:
mfpict = GlobalLock(U(stg_med)->hMetaFilePict);
data_size = GetMetaFileBitsEx(mfpict->hMF, 0, NULL);
@@ -4133,6 +4156,9 @@ static void get_stgmedium(CLIPFORMAT cfFormat, STGMEDIUM *stgmedium)
{
switch (cfFormat)
{
+ case CF_DIB:
+ create_dib(stgmedium);
+ break;
case CF_METAFILEPICT:
create_mfpict(stgmedium);
break;
@@ -4162,6 +4188,15 @@ static void test_data_cache_save_data(void)
static struct tests_data_cache *pdata, data[] =
{
+ {
+ {
+ { CF_DIB, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL },
+ },
+ 1, 1, &CLSID_WineTest,
+ {
+ &CLSID_WineTest, 1, { { "\2OlePres000", CF_DIB, DVASPECT_CONTENT, 0, NULL, 0 } }
+ }
+ },
{
{
{ CF_METAFILEPICT, 0, DVASPECT_CONTENT, -1, TYMED_MFPICT },
--
2.14.1
Nov. 28, 2017
[PATCH 1/2] ole32/tests: Add some tests for testing metafiles.
by Sergio Gómez Del Real
Signed-off-by: Sergio Gómez Del Real <sdelreal(a)codeweavers.com>
---
dlls/ole32/tests/ole2.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 157 insertions(+), 1 deletion(-)
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index a72985e239..59a0fe172f 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -229,6 +229,24 @@ static void create_bitmap( STGMEDIUM *med )
med->pUnkForRelease = NULL;
}
+static void create_mfpict(STGMEDIUM *med)
+{
+ METAFILEPICT *mf;
+ HDC hdc = CreateMetaFileW(NULL);
+
+ Rectangle(hdc, 0, 0, 100, 200);
+
+ med->tymed = TYMED_MFPICT;
+ U(med)->hMetaFilePict = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
+ mf = GlobalLock(U(med)->hMetaFilePict);
+ mf->mm = MM_ANISOTROPIC;
+ mf->xExt = 100;
+ mf->yExt = 200;
+ mf->hMF = CloseMetaFile(hdc);
+ GlobalUnlock(U(med)->hMetaFilePict);
+ med->pUnkForRelease = NULL;
+}
+
static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
{
CHECK_EXPECTED_METHOD("OleObject_QueryInterface");
@@ -3939,7 +3957,7 @@ static void check_storage_contents(IStorage *stg, const struct storage_def *stg_
int clipformat = -1;
PresentationDataHeader header;
char name[32];
- BYTE data[256];
+ BYTE data[1024];
memset(&header, 0, sizeof(header));
@@ -4074,6 +4092,143 @@ static IStorage *create_storage_from_def(const struct storage_def *stg_def)
return stg;
}
+static const BYTE mf_rec[] =
+{
+ 0xd7, 0xcd, 0xc6, 0x9a, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x16, 0x00, 0x2d, 0x00, 0x40, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x6a, 0x55
+};
+
+static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *stg_med, int stm_idx)
+{
+ BYTE *data;
+ int data_size;
+ METAFILEPICT *mfpict;
+
+ switch (cf)
+ {
+ case CF_METAFILEPICT:
+ mfpict = GlobalLock(U(stg_med)->hMetaFilePict);
+ data_size = GetMetaFileBitsEx(mfpict->hMF, 0, NULL);
+ if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
+ {
+ data = HeapAlloc(GetProcessHeap(), 0, data_size + sizeof(mf_rec));
+ memcpy(data, mf_rec, sizeof(mf_rec));
+ GetMetaFileBitsEx(mfpict->hMF, data_size, data + sizeof(mf_rec));
+ data_size += sizeof(mf_rec);
+ }
+ else
+ {
+ data = HeapAlloc(GetProcessHeap(), 0, data_size);
+ GetMetaFileBitsEx(mfpict->hMF, data_size, data);
+ }
+ GlobalUnlock(U(stg_med)->hMetaFilePict);
+ stg_def->stream[stm_idx].data_size = data_size;
+ stg_def->stream[stm_idx].data = data;
+ break;
+ }
+}
+
+static void get_stgmedium(CLIPFORMAT cfFormat, STGMEDIUM *stgmedium)
+{
+ switch (cfFormat)
+ {
+ case CF_METAFILEPICT:
+ create_mfpict(stgmedium);
+ break;
+ default:
+ ok(0, "cf %x not implemented\n", cfFormat);
+ }
+}
+
+#define MAX_FMTS 5
+static void test_data_cache_save_data(void)
+{
+ HRESULT hr;
+ STGMEDIUM stgmed;
+ ILockBytes *ilb;
+ IStorage *doc;
+ IOleCache2 *cache;
+ IPersistStorage *persist;
+ int enumerated_streams, matched_streams, i;
+ DWORD dummy;
+ struct tests_data_cache
+ {
+ FORMATETC fmts[MAX_FMTS];
+ int num_fmts, num_set;
+ const CLSID *clsid;
+ struct storage_def stg_def;
+ };
+
+ static struct tests_data_cache *pdata, data[] =
+ {
+ {
+ {
+ { CF_METAFILEPICT, 0, DVASPECT_CONTENT, -1, TYMED_MFPICT },
+ },
+ 1, 1, &CLSID_WineTest,
+ {
+ &CLSID_WineTest, 1, { { "\2OlePres000", CF_METAFILEPICT, DVASPECT_CONTENT, 0, NULL, 0 } }
+ }
+ },
+ {
+ {
+ { 0 }
+ }
+ }
+ };
+
+ /* test _Save after caching directly through _Cache + _SetData */
+ for (pdata = data; pdata->clsid != NULL; pdata++)
+ {
+ hr = CreateDataCache(NULL, pdata->clsid, &IID_IOleCache2, (void **)&cache);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+
+ for (i = 0; i < pdata->num_fmts; i++)
+ {
+ hr = IOleCache2_Cache(cache, &pdata->fmts[i], 0, &dummy);
+ ok(SUCCEEDED(hr), "unexpected %#x\n", hr);
+ if (i < pdata->num_set)
+ {
+ get_stgmedium(pdata->fmts[i].cfFormat, &stgmed);
+ get_stgdef(&pdata->stg_def, pdata->fmts[i].cfFormat, &stgmed, i);
+ hr = IOleCache2_SetData(cache, &pdata->fmts[i], &stgmed, TRUE);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+ }
+ }
+
+ /* create Storage in memory where we'll save cache */
+ hr = CreateILockBytesOnHGlobal(0, TRUE, &ilb);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+ hr = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &doc);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+ ILockBytes_Release(ilb);
+ hr = IStorage_SetClass(doc, pdata->clsid);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+
+ hr = IOleCache2_QueryInterface(cache, &IID_IPersistStorage, (void **)&persist);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+
+ /* cache entries are dirty. test saving them to stg */
+ trace("IPersistStorage_Save:\n");
+ hr = IPersistStorage_Save(persist, doc, FALSE);
+ ok(hr == S_OK, "unexpected %#x\n", hr);
+
+ check_storage_contents(doc, &pdata->stg_def, &enumerated_streams, &matched_streams);
+ ok(enumerated_streams == matched_streams, "enumerated %d != matched %d\n",
+ enumerated_streams, matched_streams);
+ ok(enumerated_streams == pdata->stg_def.stream_count, "created %d != def streams %d\n",
+ enumerated_streams, pdata->stg_def.stream_count);
+
+ for (i = 0; i < pdata->num_set; i++)
+ HeapFree(GetProcessHeap(), 0, (void *)pdata->stg_def.stream[i].data);
+
+ IPersistStorage_Release(persist);
+ IStorage_Release(doc);
+ IOleCache2_Release(cache);
+ }
+}
+
static void test_data_cache_contents(void)
{
HRESULT hr;
@@ -4199,6 +4354,7 @@ START_TEST(ole2)
test_OleDraw();
test_OleDoAutoConvert();
test_data_cache_save();
+ test_data_cache_save_data();
test_data_cache_contents();
CoUninitialize();
--
2.14.1
Nov. 28, 2017
[PATCH 5/5] wevtapi: Add EvtOpenLog stub.
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
Needed by Event Log Explorer,
http://download.cnet.com/Event-Log-Explorer/3001-2094_4-74668.html
---
dlls/wevtapi/main.c | 6 ++++++
dlls/wevtapi/wevtapi.spec | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wevtapi/main.c b/dlls/wevtapi/main.c
index 0dfe522f06..5b9949bad6 100644
--- a/dlls/wevtapi/main.c
+++ b/dlls/wevtapi/main.c
@@ -50,6 +50,12 @@ EVT_HANDLE WINAPI EvtOpenSession(EVT_LOGIN_CLASS login_class, void *login, DWORD
return NULL;
}
+EVT_HANDLE WINAPI EvtOpenLog(EVT_HANDLE session, const WCHAR *path, DWORD flags)
+{
+ FIXME("(%p %s %u) stub\n", session, debugstr_w(path), flags);
+ return NULL;
+}
+
BOOL WINAPI EvtGetChannelConfigProperty(EVT_HANDLE ChannelConfig,
EVT_CHANNEL_CONFIG_PROPERTY_ID PropertyId,
DWORD Flags,
diff --git a/dlls/wevtapi/wevtapi.spec b/dlls/wevtapi/wevtapi.spec
index 84420bd5d3..8fb5a08d0f 100644
--- a/dlls/wevtapi/wevtapi.spec
+++ b/dlls/wevtapi/wevtapi.spec
@@ -32,7 +32,7 @@
@ stdcall EvtOpenChannelConfig(ptr wstr long)
@ stdcall EvtOpenChannelEnum(ptr long)
@ stub EvtOpenEventMetadataEnum
-@ stub EvtOpenLog
+@ stdcall EvtOpenLog(ptr wstr long)
@ stub EvtOpenPublisherEnum
@ stub EvtOpenPublisherMetadata
@ stdcall EvtOpenSession(long ptr long long)
--
2.15.0
Nov. 28, 2017
[PATCH 4/5] wevtapi: Add EvtNextChannelPath stub.
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
Needed by Event Log Explorer,
http://download.cnet.com/Event-Log-Explorer/3001-2094_4-74668.html
---
dlls/wevtapi/main.c | 6 ++++++
dlls/wevtapi/wevtapi.spec | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wevtapi/main.c b/dlls/wevtapi/main.c
index 50696ba321..0dfe522f06 100644
--- a/dlls/wevtapi/main.c
+++ b/dlls/wevtapi/main.c
@@ -86,6 +86,12 @@ EVT_HANDLE WINAPI EvtOpenChannelEnum(EVT_HANDLE session, DWORD flags)
return NULL;
}
+BOOL WINAPI EvtNextChannelPath(EVT_HANDLE channel_enum, DWORD buffer_len, WCHAR *buffer, DWORD *used)
+{
+ FIXME("(%p %u %p %p) stub\n", channel_enum, buffer_len, buffer, used);
+ return FALSE;
+}
+
EVT_HANDLE WINAPI EvtOpenChannelConfig(EVT_HANDLE Session, LPCWSTR ChannelPath, DWORD Flags)
{
FIXME("(%p %s %u) stub\n", Session, debugstr_w(ChannelPath), Flags);
diff --git a/dlls/wevtapi/wevtapi.spec b/dlls/wevtapi/wevtapi.spec
index 070fd09232..84420bd5d3 100644
--- a/dlls/wevtapi/wevtapi.spec
+++ b/dlls/wevtapi/wevtapi.spec
@@ -26,7 +26,7 @@
@ stub EvtIntSysprepCleanup
@ stub EvtIntWriteXmlEventToLocalLogfile
@ stub EvtNext
-@ stub EvtNextChannelPath
+@ stdcall EvtNextChannelPath(ptr long wstr ptr)
@ stub EvtNextEventMetadata
@ stub EvtNextPublisherId
@ stdcall EvtOpenChannelConfig(ptr wstr long)
--
2.15.0
Nov. 28, 2017