The GetComputerNameEx API function is not available on Windows 9x. As a result
the LoadLibrary API function loading the win32-loader plugin dll fails because
the reference of GetComputerNameExA in the import table could not be resolved
on Windows 9x.

The would propose the attached patch to fix this issue.

GetComputerNameExA API function is not available on Windows 9x kernel32.dll
--- win32-loader/plugins/systeminfo/systeminfo.c.orig	2009-12-02 11:42:33.000000000 +0100
+++ win32-loader/plugins/systeminfo/systeminfo.c	2009-12-09 18:07:43.000000000 +0100
@@ -32,9 +32,25 @@
 	BOOL result;
 	DWORD dwStringSize = g_stringsize;
 	stack_t *th;
+	typedef BOOL (WINAPI *pfGCNE)(COMPUTER_NAME_FORMAT, LPTSTR, LPDWORD);
+	pfGCNE GetComputerNameExFunc = (pfGCNE) GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetComputerNameExA");
 	if (!g_stacktop) return;
 	th = (stack_t*) GlobalAlloc(GPTR, sizeof(stack_t) + g_stringsize);
-	result = GetComputerNameExA(format, th->text, &dwStringSize);
+	if (GetComputerNameExFunc)
+        {
+		result = GetComputerNameExFunc(format, th->text, &dwStringSize);
+	}
+	else
+	{
+		if (ComputerNameDnsHostname == format)
+		{
+			result = GetComputerNameA(th->text, &dwStringSize);
+		}
+		else
+		{
+			result = 0;
+		}
+	}	
 	th->next = *g_stacktop;
 	*g_stacktop = th;
 	wsprintf(buf, "%u", result);

Reply via email to