Skip to content

Commit

Permalink
patch GetOpenFileName to remove hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Nov 9, 2023
1 parent 15eed3d commit ef1d881
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Binary file modified msil/System.Windows.Forms.dll
Binary file not shown.
1 change: 1 addition & 0 deletions wrappers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ link_libraries(corkdebug)
add_library(corkel32 SHARED
kernel32.c
advapi32.c
comdlg32.c
corkel32.def
)

Expand Down
24 changes: 24 additions & 0 deletions wrappers/comdlg32.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#define _WIN32_WINNT 0x0400
#include <windows.h>

#include "debug.h"

BOOL WINAPI CORKEL32_GetOpenFileNameA(LPOPENFILENAMEA lpOpenFileName)
{
Trace(TRACE_PASSTHROUGH, "GetOpenFileNameA");

// .NET's hook crashes USER.EXE, so we remove it here
lpOpenFileName->lpfnHook = NULL;

return GetOpenFileNameA(lpOpenFileName);
}

BOOL WINAPI CORKEL32_GetOpenFileNameW(LPOPENFILENAMEW lpOpenFileName)
{
Trace(TRACE_PASSTHROUGH, "GetOpenFileNameW");

// .NET's hook crashes USER.EXE, so we remove it here
lpOpenFileName->lpfnHook = NULL;

return GetOpenFileNameW(lpOpenFileName);
}
2 changes: 2 additions & 0 deletions wrappers/corkel32.def
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,5 @@ EXPORTS
ExpandEnvironmentStringsW=CORKEL32_ExpandEnvironmentStringsW
lstrcmpiA=CORKEL32_lstrcmpiA
GetConsoleScreenBufferInfo=CORKEL32_GetConsoleScreenBufferInfo
GetOpenFileNameA=CORKEL32_GetOpenFileNameA
GetOpenFileNameW=CORKEL32_GetOpenFileNameW

0 comments on commit ef1d881

Please sign in to comment.