Dmitry Timoshkov wrote:
"Christopher" raccoonone@procyongames.com wrote:
+static void test_LoadStringW(void) +{
- HINSTANCE hInst = GetModuleHandle(NULL);
- WCHAR copiedstring[128], returnedstring[128], *resourcepointer =
NULL;
- int strlen, strlen2;
- /* Check that the string which is returned by LoadStringW
matches + the string at the pointer returned by Load StringW when called with buflen = 0 */
- strlen = LoadStringW(hInst, 2, (WCHAR *) &resourcepointer, 0);
/* get pointer to resource. */
- ok(strlen > 0, "LoadStringW failed to get pointer to resource 2,
ret %d, err %d \n", strlen, GetLastError());
- strlen2 = LoadStringW(hInst, 2, returnedstring,
sizeof(returnedstring) /sizeof(WCHAR));
- ok(strlen == strlen2, "LoadStringW returned different values
dependent on buflen. ret1 %d, ret2 %d \n", + strlen, strlen2);
- ok(strlen2 > 0, "LoadStringW failed to load resource 2, ret %d,
err %d \n", strlen2, GetLastError());
- if(resourcepointer != NULL)
- {
memcpy(copiedstring, resourcepointer, strlen * sizeof(WCHAR));
copiedstring[strlen] = '\0';
- }
- /* check that strings match */
- ok(!memcmp(copiedstring, returnedstring, (strlen +
1)*sizeof(WCHAR)),
"LoadStringW returned a string that does not match the
string pointed to by the pointer it returned. \
returnedstring = %ls, copiedstring = %ls", returnedstring,
copiedstring); +}
It's not clear what this test is supposed to show. If the 1st call to LoadStringW is supposed to set resourcepointer to not NULL, why don't you test it? Then 'if(resourcepointer != NULL)' check and copying to copiedstring are not needed.
Also, if the test depends on a later patch to not fail, the test should be included in the patch.
Even if I check for resourcepointer != NULL in an ok() [which I will add], I still need the if block. String resources are not '\0' terminated, and I wish to compare it to the string that was returned by LoadStringW