Skip to content

Compiling 'CRegistryPlugin' for 'x86' #55

@gvanem

Description

@gvanem

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions