DarthTon / Blackbone

Windows memory hacking library
MIT License
4.83k stars 1.34k forks source link

Release(XP) not supported? #517

Closed UnrealKaraulov closed 1 month ago

UnrealKaraulov commented 1 month ago

objbase.h(239): error : identifier "IUnknown" is undefined

...
  AsmHelper64.cpp
  LocalHookBase.cpp
  TraceHook.cpp
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C2065: 'IUnknown': undeclared identifier (compiling source file LocalHook\LocalHookBase.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C2187: syntax error: 'IUnknown' was unexpected here (compiling source file LocalHook\LocalHookBase.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C3878: syntax error: unexpected token '*' following 'expression' (compiling source file LocalHook\LocalHookBase.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): note: error recovery skipped: '* > (  . . . identifier' (compiling source file LocalHook\LocalHookBase.cpp)
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C2760: syntax error: ')' was unexpected here; expected ';' (compiling source file LocalHook\LocalHookBase.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C3878: syntax error: unexpected token ')' following 'expression_statement' (compiling source file LocalHook\LocalHookBase.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): note: error recovery skipped: ')' (compiling source file LocalHook\LocalHookBase.cpp)
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C2065: 'IUnknown': undeclared identifier (compiling source file LocalHook\TraceHook.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C2187: syntax error: 'IUnknown' was unexpected here (compiling source file LocalHook\TraceHook.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C3878: syntax error: unexpected token '*' following 'expression' (compiling source file LocalHook\TraceHook.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): note: error recovery skipped: '* > (  . . . identifier' (compiling source file LocalHook\TraceHook.cpp)
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C2760: syntax error: ')' was unexpected here; expected ';' (compiling source file LocalHook\TraceHook.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): error C3878: syntax error: unexpected token ')' following 'expression_statement' (compiling source file LocalHook\TraceHook.cpp) [D:\a\BlackBoneTest\BlackBoneTest\BlackBoneTest\Blackbone-master\src\BlackBone\BlackBone.vcxproj]
  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\objbase.h(239): note: error recovery skipped: ')' (compiling source file LocalHook\TraceHook.cpp)
  MExcept.cpp
...

Test workflow file:

name: C/C++ CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    name: 'Windows'
    runs-on: windows-latest
    steps:
     - uses: actions/checkout@v4
     - uses: ilammy/setup-nasm@v1
     - uses: shogo82148/actions-setup-perl@v1
     - uses: microsoft/setup-msbuild@v2
     - name: Install Windows XP Support for Visual Studio
       run: |
          Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
          $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
          $componentsToAdd = @(
            "Microsoft.VisualStudio.Component.WinXP"
          )
          [string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " +  $_}
          $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
          $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
          if ($process.ExitCode -eq 0)
          {
              Write-Host "components have been successfully added"
              Get-ChildItem C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Windows.XPSupport.*
          }
          else
          {
              Write-Host "components were not installed"
              exit 1
          }
     - name: Set up Visual Studio shell
       uses: egor-tensin/vs-shell@v2
       with:
         arch: Win32
     - name: Build BlackBone DEBUG/RELEASE/RELEASEXP
       run: |
           MSBuild.exe BlackBoneTest/Blackbone-master/BlackBone.sln /p:CI=true /p:Platform="win32" /p:Configuration="Debug"
           MSBuild.exe BlackBoneTest/Blackbone-master/BlackBone.sln /p:CI=true /p:Platform="win32" /p:Configuration="Release"
           MSBuild.exe BlackBoneTest/Blackbone-master/BlackBone.sln /p:CI=true /p:Platform="win32" /p:Configuration="Release(XP)"
UnrealKaraulov commented 1 month ago

Debug and release - compiled without any problems.

Release(XP) - many errors

UnrealKaraulov commented 1 month ago
#ifdef XP_BUILD
typedef struct IUnknown IUnknown;
#endif

in top of Confih.h file fix this error, but got more:

3rd_party\rewolf-wow64ext\src\cmemptr.h(37) error C3861: 'free': identifier not found

and

3rd_party\rewolf-wow64ext\src\wow64ext.cpp(397): error C2143: syntax error: missing ')' before '__stdcall' 
UnrealKaraulov commented 1 month ago
#include <stdlib.h>

in cmemptr.h for 'free' not found

UnrealKaraulov commented 1 month ago
#include <winternl.h>
#ifndef BASETYPES
#define BASETYPES
typedef unsigned long ULONG;
typedef ULONG* PULONG;
typedef unsigned short USHORT;
typedef USHORT* PUSHORT;
typedef unsigned char UCHAR;
typedef UCHAR* PUCHAR;
typedef _Null_terminated_ char* PSZ;
#endif 

After in wow64ext.cpp for fix missing ) before stdcall

UnrealKaraulov commented 1 month ago

@DarthTon this can fix Release(XP) build with 2022 visual studio.