>+static HMODULE hshell32;
>+static int (WINAPI *pSHCreateDirectoryExA)(HWND, LPCSTR, 
>LPSECURITY_ATTRIBUTES);
>+
>+static void InitFunctionPointers(void)
>+{
>+    hshell32 = GetModuleHandleA("shell32.dll");
>+
>+    if(hshell32)
>+      pSHCreateDirectoryExA = (void*)GetProcAddress(hshell32, 
>"SHCreateDirectoryExA");
>+}
>+
> /* creates a file with the specified name for tests */
> void createTestFile(CHAR *name)
> {
>@@ -398,17 +409,19 @@
>     int ret;
> 
>     set_curr_dir_path(path, "testdir2\\test4.txt\0");
>-    ret = SHCreateDirectoryExA(NULL, path, NULL);
>+    ret = pSHCreateDirectoryExA(NULL, path, NULL);

I think this is not right. Implementing dynamic loading of functions in tests is
supposedly because that function may not be available on some systems. But here 
you
invoke the (maybe uninitialized, or NULL assigned) function pointer nevertheless
without protecting for this.

As such your patch does only allow loading the test on such systems but will
create a nice crash when run.

Rolf Kalbermatter
 



Reply via email to