Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling 'CRegistryPlugin' for 'x86' #55

Open
gvanem opened this issue Dec 30, 2022 · 0 comments
Open

Compiling 'CRegistryPlugin' for 'x86' #55

gvanem opened this issue Dec 30, 2022 · 0 comments

Comments

@gvanem
Copy link

gvanem commented Dec 30, 2022

Hello!

I had no problems building CRegistryPlugin64.dll for x64.
But doing the same for x86 yields a bunch of C++ errors due to my_ssize_t etc.:

RegistryPlugin.cpp(103): error C2664: 'HRESULT Deviare2::INktHookInfo::get_Address(__int64 *)': cannot convert argument 1 from 
'long *' to ' __int64 *'
RegistryPlugin.cpp(103): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
RegistryPlugin.cpp(103): note: while trying to match the argument list '(long *)'
RegistryPlugin.cpp(117): error C2664: 'HRESULT Deviare2::INktHookInfo::get_Address(__int64 *)': cannot convert argument 1 from 
'long *' to '__int64 *'
RegistryPlugin.cpp(117): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
...

I'm not sure how this should be fixed. But these are my patches:

--- a/RegistryPlugin.cpp 2022-12-27 12:27:45
+++ b/RegistryPlugin.cpp 2022-12-30 08:28:50
@@ -96,13 +96,13 @@
                                      __in LPCWSTR szParametersW)
 {
   CComBSTR functionName;
-  my_ssize_t address;
+  __int64 address;
   CHAR szBufA[1024];

   lpHookInfo->get_FunctionName(&functionName);
   lpHookInfo->get_Address(&address);
   sprintf_s(szBufA, 1024, "MyRegistryPlugin::OnHookAdded called [Hook: %S @ 0x%IX / Chain:%lu]",
-            (BSTR)functionName, address, dwChainIndex);
+            (BSTR)functionName, (my_ssize_t)address, dwChainIndex);
   ::OutputDebugStringA(szBufA);
   return S_OK;
 }
@@ -110,13 +110,13 @@
 MY_EXPORT VOID WINAPI OnHookRemoved(__in INktHookInfo *lpHookInfo, __in DWORD dwChainIndex)
 {
   CComBSTR functionName;
-  my_ssize_t address;
+  __int64 address;
   CHAR szBufA[1024];

   lpHookInfo->get_FunctionName(&functionName);
   lpHookInfo->get_Address(&address);
   sprintf_s(szBufA, 1024, "MyRegistryPlugin::OnHookRemoved called [Hook: %S @ 0x%IX / Chain:%lu]",
-            (BSTR)functionName, address, dwChainIndex);
+            (BSTR)functionName, (my_ssize_t)address, dwChainIndex);
   ::OutputDebugStringA(szBufA);
   return;
 }
@@ -126,7 +126,7 @@
 {
   CComBSTR functionName, tempBStr[2];
   CComPtr<INktParamsEnum> paramsEnum;
-  my_ssize_t address;
+  __int64 address;
   CHAR szBufA[1024];
   WCHAR szBufW[64];
   long i, paramCount;
@@ -135,7 +135,7 @@
   lpHookInfo->get_FunctionName(&functionName);
   lpHookInfo->get_Address(&address);
   sprintf_s(szBufA, 1024, "MyRegistryPlugin::OnFunctionCall called [Hook: %S @ 0x%IX / Chain:%lu]",
-            (BSTR)functionName, address, dwChainIndex);
+            (BSTR)functionName, (my_ssize_t)address, dwChainIndex);
   ::OutputDebugStringA(szBufA);

   hRes = lpHookCallInfoPlugin->Params(&paramsEnum);
@@ -183,7 +183,7 @@
     if (param != NULL)
     {
       CComBSTR type, paramNo;
-      my_size_t size;
+      DWORD64 size;

       hRes = param->get_TypeName(&type);
       if (SUCCEEDED(hRes) && type != NULL && wcscmp(type, L"HKEY") == 0)

It now compiles w/o warnings for both x86 and x64.
Remains to be tested. But how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant