Skip to content

Instantly share code, notes, and snippets.

@cotsog
Created November 6, 2009 00:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cotsog/227555 to your computer and use it in GitHub Desktop.
Save cotsog/227555 to your computer and use it in GitHub Desktop.
Apply this patch to ATL 7.1 bundled with the Windows Driver Kit to be able to compile Google Chrome with Visaul C++ 2008 Express Edition. See http://bit.ly/30slOj for more details.
--- C:/Documents and Settings/user/Desktop/atlstdthunk.h Wed Oct 21 21:29:23 2009
+++ C:/WinDDK/6001.18002/inc/crt/atl71/atlstdthunk.h Wed Oct 21 21:28:19 2009
@@ -40,8 +40,8 @@
// Thunks for __stdcall member functions
#if defined(_M_IX86)
-PVOID __stdcall __AllocStdCallThunk(VOID);
-VOID __stdcall __FreeStdCallThunk(PVOID);
+void* __stdcall __AllocStdCallThunk();
+void __stdcall __FreeStdCallThunk(void* ptr);
#pragma pack(push,1)
struct _stdcallthunk
@@ -76,9 +76,23 @@
}
};
#pragma pack(pop)
+
+inline void* __stdcall __AllocStdCallThunk()
+{
+ LPVOID mem = VirtualAlloc(0, sizeof(_stdcallthunk), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ if (!mem) return 0;
+ return mem;
+}
+
+inline void __stdcall __FreeStdCallThunk(void* ptr)
+{
+ if (!ptr) return;
+ VirtualFree(ptr, 0, MEM_RELEASE);
+}
+
#elif defined(_M_AMD64)
-PVOID __AllocStdCallThunk(VOID);
-VOID __FreeStdCallThunk(PVOID);
+void* __AllocStdCallThunk();
+void __FreeStdCallThunk(void* ptr);
#pragma pack(push,2)
struct _stdcallthunk
{
@@ -112,6 +126,20 @@
}
};
#pragma pack(pop)
+
+inline void* __AllocStdCallThunk()
+{
+ LPVOID mem = VirtualAlloc(0, sizeof(_stdcallthunk), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ if (!mem) return 0;
+ return mem;
+}
+
+inline void __FreeStdCallThunk(void* ptr)
+{
+ if (!ptr) return;
+ VirtualFree(ptr, 0, MEM_RELEASE);
+}
+
#elif defined (_M_ALPHA)
// For ALPHA we will stick the this pointer into a0, which is where
// the HWND is. However, we don't actually need the HWND so this is OK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment