Skip to content

Commit

Permalink
More black magic to support W2k.
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Feb 4, 2016
1 parent cb3f3a5 commit 2258e5b
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 1 deletion.
20 changes: 19 additions & 1 deletion plugins/common/vc_crt_fix.asm
Expand Up @@ -35,17 +35,35 @@ EncodePointerWrapper proto stdcall :dword
DecodePointerWrapper proto stdcall :dword
GetModuleHandleExWWrapper proto stdcall :dword, :dword, :dword
InitializeSListHeadWrapper proto stdcall :dword
InterlockedFlushSListWrapper proto stdcall :dword
InterlockedPopEntrySListWrapper proto stdcall :dword
InterlockedPushEntrySListWrapper proto stdcall :dword, :dword
InterlockedPushListSListExWrapper proto stdcall :dword, :dword, :dword, :dword
RtlFirstEntrySListWrapper proto stdcall :dword
QueryDepthSListWrapper proto stdcall :dword

.const
align 4
__imp__EncodePointer@4 dd EncodePointerWrapper
__imp__DecodePointer@4 dd DecodePointerWrapper
__imp__GetModuleHandleExW@12 dd GetModuleHandleExWWrapper
__imp__InitializeSListHead@4 dd InitializeSListHeadWrapper
__imp__InterlockedFlushSList@4 dd InterlockedFlushSListWrapper
__imp__InterlockedPopEntrySList@4 dd InterlockedPopEntrySListWrapper
__imp__InterlockedPushEntrySList@8 dd InterlockedPushEntrySListWrapper
__imp__InterlockedPushListSListEx@16 dd InterlockedPushListSListExWrapper
__imp__RtlFirstEntrySList@4 dd RtlFirstEntrySListWrapper
__imp__QueryDepthSList@4 dd QueryDepthSListWrapper

public \
__imp__EncodePointer@4,
__imp__DecodePointer@4,
__imp__GetModuleHandleExW@12,
__imp__InitializeSListHead@4
__imp__InitializeSListHead@4,
__imp__InterlockedFlushSList@4,
__imp__InterlockedPopEntrySList@4,
__imp__InterlockedPushEntrySList@8,
__imp__InterlockedPushListSListEx@16,
__imp__RtlFirstEntrySList@4,
__imp__QueryDepthSList@4
end
96 changes: 96 additions & 0 deletions plugins/common/vc_crt_fix_impl.cpp
Expand Up @@ -111,6 +111,102 @@ extern "C" void WINAPI InitializeSListHeadWrapper(PSLIST_HEADER ListHead)
return Function(ListHead);
}

// InterlockedFlushSList (VC2015)
extern "C" PSLIST_ENTRY WINAPI InterlockedFlushSListWrapper(PSLIST_HEADER ListHead)
{
struct implementation
{
static PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER ListHead)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return nullptr;
}
};

CREATE_FUNCTION_POINTER(kernel32, InterlockedFlushSList);
return Function(ListHead);
}

// InterlockedPopEntrySList (VC2015)
extern "C" PSLIST_ENTRY WINAPI InterlockedPopEntrySListWrapper(PSLIST_HEADER ListHead)
{
struct implementation
{
static PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return nullptr;
}
};

CREATE_FUNCTION_POINTER(kernel32, InterlockedPopEntrySList);
return Function(ListHead);
}

// InterlockedPushEntrySList (VC2015)
extern "C" PSLIST_ENTRY WINAPI InterlockedPushEntrySListWrapper(PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry)
{
struct implementation
{
static PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return nullptr;
}
};

CREATE_FUNCTION_POINTER(kernel32, InterlockedPushEntrySList);
return Function(ListHead, ListEntry);
}

// InterlockedPushListSList (VC2015)
extern "C" PSLIST_ENTRY WINAPI InterlockedPushListSListExWrapper(PSLIST_HEADER ListHead, PSLIST_ENTRY List, PSLIST_ENTRY ListEnd, ULONG Count)
{
struct implementation
{
static PSLIST_ENTRY WINAPI InterlockedPushListSListEx(PSLIST_HEADER ListHead, PSLIST_ENTRY List, PSLIST_ENTRY ListEnd, ULONG Count)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return nullptr;
}
};

CREATE_FUNCTION_POINTER(kernel32, InterlockedPushListSListEx);
return Function(ListHead, List, ListEnd, Count);
}

// RtlFirstEntrySList (VC2015)
extern "C" PSLIST_ENTRY WINAPI RtlFirstEntrySListWrapper(PSLIST_HEADER ListHead)
{
struct implementation
{
static PSLIST_ENTRY WINAPI RtlFirstEntrySList(PSLIST_HEADER ListHead)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return nullptr;
}
};

CREATE_FUNCTION_POINTER(kernel32, RtlFirstEntrySList);
return Function(ListHead);
}

// QueryDepthSList (VC2015)
extern "C" USHORT WINAPI QueryDepthSListWrapper(PSLIST_HEADER ListHead)
{
struct implementation
{
static USHORT WINAPI QueryDepthSList(PSLIST_HEADER ListHead)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
};

CREATE_FUNCTION_POINTER(kernel32, QueryDepthSList);
return Function(ListHead);
}

// RtlGenRandom (VC2015)
// RtlGenRandom is used in rand_s implementation in ucrt.
// As long as we don't use the rand_s in the code (which is easy: it's non-standard, requires _CRT_RAND_S to be defined first and not recommended in general)
Expand Down

0 comments on commit 2258e5b

Please sign in to comment.