https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2eaf5264848f5fa9b9e0a…
commit 2eaf5264848f5fa9b9e0a35ff589cb6c086bc8de
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sat Feb 24 14:57:00 2018 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Apr 22 18:51:48 2018 +0200
[SHIMLIB] Update helper functions, add ShimLib_StringNDuplicateA
---
dll/appcompat/shims/shimlib/shimlib.c | 11 ++++++++---
dll/appcompat/shims/shimlib/shimlib.h | 17 +++++++++--------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/dll/appcompat/shims/shimlib/shimlib.c
b/dll/appcompat/shims/shimlib/shimlib.c
index 54d64799d1..b9c2652ab6 100644
--- a/dll/appcompat/shims/shimlib/shimlib.c
+++ b/dll/appcompat/shims/shimlib/shimlib.c
@@ -50,11 +50,16 @@ void ShimLib_ShimFree(PVOID pData)
HeapFree(g_ShimLib_Heap, 0, pData);
}
+PCSTR ShimLib_StringNDuplicateA(PCSTR szString, SIZE_T stringLengthIncludingNullTerm)
+{
+ PSTR NewString = ShimLib_ShimMalloc(stringLengthIncludingNullTerm);
+ StringCchCopyA(NewString, stringLengthIncludingNullTerm, szString);
+ return NewString;
+}
+
PCSTR ShimLib_StringDuplicateA(PCSTR szString)
{
- SIZE_T Length = lstrlenA(szString);
- PSTR NewString = ShimLib_ShimMalloc(Length+1);
- return lstrcpyA(NewString, szString);
+ return ShimLib_StringNDuplicateA(szString, lstrlenA(szString) + 1);
}
BOOL ShimLib_StrAEqualsW(PCSTR szString, PCWSTR wszString)
diff --git a/dll/appcompat/shims/shimlib/shimlib.h
b/dll/appcompat/shims/shimlib/shimlib.h
index b6a6743e7b..5eaf1853ab 100644
--- a/dll/appcompat/shims/shimlib/shimlib.h
+++ b/dll/appcompat/shims/shimlib/shimlib.h
@@ -2,7 +2,7 @@
* PROJECT: ReactOS Shim helper library
* LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: ReactOS Shim Engine common functions / structures
- * COPYRIGHT: Copyright 2016,2017 Mark Jansen (mark.jansen(a)reactos.org)
+ * COPYRIGHT: Copyright 2016-2018 Mark Jansen (mark.jansen(a)reactos.org)
*/
#pragma once
@@ -17,16 +17,17 @@ typedef struct tagHOOKAPI
} HOOKAPI, *PHOOKAPI;
-PVOID ShimLib_ShimMalloc(SIZE_T);
-void ShimLib_ShimFree(PVOID);
-PCSTR ShimLib_StringDuplicateA(PCSTR);
-BOOL ShimLib_StrAEqualsW(PCSTR, PCWSTR);
+PVOID ShimLib_ShimMalloc(SIZE_T dwSize);
+VOID ShimLib_ShimFree(PVOID pData);
+PCSTR ShimLib_StringDuplicateA(PCSTR szString);
+PCSTR ShimLib_StringNDuplicateA(PCSTR szString, SIZE_T stringLength);
+BOOL ShimLib_StrAEqualsW(PCSTR szString, PCWSTR wszString);
/* Forward events to generic handlers */
-void ShimLib_Init(HINSTANCE);
-void ShimLib_Deinit(void);
-PHOOKAPI WINAPI ShimLib_GetHookAPIs(LPCSTR,LPCWSTR,PDWORD);
+VOID ShimLib_Init(HINSTANCE hInstance);
+VOID ShimLib_Deinit(VOID);
+PHOOKAPI WINAPI ShimLib_GetHookAPIs(LPCSTR szCommandLine,LPCWSTR wszShimName,PDWORD
pdwHookCount);
BOOL WINAPI ShimLib_NotifyShims(DWORD fdwReason, PVOID ptr);