diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 0f62cd3..f6a647e 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -19,9 +19,22 @@ jobs: egress-policy: audit - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Run clang-format style check for C/C++ programs. - uses: jidicula/clang-format-action@6cd220de46c89139a0365edae93eee8eb30ca8fe # v4.16.0 - with: - clang-format-version: '17' - exclude-regex: 'include/*' - fallback-style: 'Microsoft' \ No newline at end of file + + - name: Install clang-format + run: | + sudo apt-get update + sudo apt-get install -y clang-format-17 + + - name: Run clang-format style check + run: | + # Find all C/C++ files, excluding include directory + files=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.c" \) \ + ! -path "./include/*" ! -path "./.git/*" | sort) + + if [ -z "$files" ]; then + echo "No C/C++ files found" + exit 0 + fi + + # Check formatting (--dry-run -Werror exits non-zero if changes needed) + echo "$files" | xargs clang-format-17 --verbose --dry-run -Werror --style=file --fallback-style=Microsoft diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c208df1..2a528e2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -15,7 +15,8 @@ permissions: jobs: analyze: name: Analyze (${{ matrix.language }}) - runs-on: windows-latest + # Use VS 2026 preview runner (GA May 4, 2026, then switch to windows-2025) + runs-on: windows-2025-vs2026 permissions: packages: read actions: read @@ -39,9 +40,14 @@ jobs: with: submodules: 'recursive' + - name: Install Windows 11 SDK (10.0.22621.0) + shell: pwsh + run: | + & "${{ github.workspace }}\scripts\install-winsdk.ps1" + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5 + uses: github/codeql-action/init@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -53,11 +59,11 @@ jobs: # queries: security-extended,security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5 + uses: github/codeql-action/autobuild@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2 - name: Perform CodeQL Analysis id: analyze - uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5 + uses: github/codeql-action/analyze@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml index 78c29bf..2f1f5ff 100644 --- a/.github/workflows/devskim.yml +++ b/.github/workflows/devskim.yml @@ -29,11 +29,11 @@ jobs: uses: microsoft/DevSkim-Action@4b5047945a44163b94642a1cecc0d93a3f428cc6 # v1.0.16 - name: Upload DevSkim scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5 + uses: github/codeql-action/upload-sarif@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2 with: sarif_file: devskim-results.sarif - name: Upload DevSkim scan results as an artifact uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: - path: devskim-results.sarif \ No newline at end of file + path: devskim-results.sarif diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml index 9da3fb6..ed4931c 100644 --- a/.github/workflows/github-ci.yml +++ b/.github/workflows/github-ci.yml @@ -13,13 +13,25 @@ permissions: jobs: build: - runs-on: windows-latest + # Use VS 2026 preview runner (GA May 4, 2026, then switch to windows-2025) + runs-on: windows-2025-vs2026 permissions: security-events: write strategy: + fail-fast: false matrix: configuration: [ 'Release', 'Debug', 'Release_Unicode', 'Debug_Unicode' ] - platform: [ 'Win32', 'x64' ] + platform: [ 'Win32', 'x64', 'ARM64', 'ARM64EC' ] + exclude: + # ARM64/ARM64EC only need Unicode builds + - platform: ARM64 + configuration: Release + - platform: ARM64 + configuration: Debug + - platform: ARM64EC + configuration: Release + - platform: ARM64EC + configuration: Debug steps: - name: Harden Runner @@ -32,11 +44,17 @@ jobs: with: submodules: 'recursive' + - name: Install Windows 11 SDK (10.0.22621.0) + shell: pwsh + run: | + & "${{ github.workspace }}\scripts\install-winsdk.ps1" + - name: "Build" shell: pwsh run: | - $path = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath - & $path\MSBuild\Current\Bin\amd64\msbuild.exe /m /p:Configuration="${{matrix.configuration}}" /p:Platform="${{matrix.platform}}" mapistub.sln + $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin\amd64\msbuild.exe" + & $msbuildPath /m /p:Configuration="${{matrix.configuration}}" /p:Platform="${{matrix.platform}}" mapistub.sln publish-test-results: name: "Publish Tests Results" @@ -63,4 +81,4 @@ jobs: - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0 with: - files: "artifacts/**/*.trx" \ No newline at end of file + files: "artifacts/**/*.trx" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 8718cf7..9827af2 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -71,6 +71,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5 + uses: github/codeql-action/upload-sarif@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2 with: sarif_file: results.sarif diff --git a/.vsconfig b/.vsconfig index 77f62a5..da07a9d 100644 --- a/.vsconfig +++ b/.vsconfig @@ -29,7 +29,7 @@ "Microsoft.VisualStudio.Component.VC.Tools.ARM64", "Microsoft.VisualStudio.Component.VC.Tools.ARM64EC", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - "Microsoft.VisualStudio.Component.Windows10SDK.18362", + "Microsoft.VisualStudio.Component.Windows11SDK.22621", "Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", "Microsoft.VisualStudio.Workload.CoreEditor", diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..5859a4d --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,38 @@ + + + + + v145 + + + 10.0.22621.0 + + + + Spectre + false + Guard + true + + + + + + + Level4 + true + true + stdcpplatest + + + true + + + + + + + false + + + diff --git a/docs/Building.md b/docs/Building.md index 3f77212..5465cae 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -35,9 +35,9 @@ The project includes all necessary MAPI headers in the `include` directory, so n You now have a file, `MAPIStubLibrary.lib`, which you can link in to your project. -## Building with Node.js/node-gyp +## Building with Node.js scripts -Alternatively, you can build using Node.js and node-gyp (this creates a static library): +The npm scripts now use MSBuild by default (and keep node-gyp scripts under `gyp:*`): 1. **Install Node.js**: Make sure you have [Node.js](https://nodejs.org/) installed. @@ -47,30 +47,45 @@ Alternatively, you can build using Node.js and node-gyp (this creates a static l npm install ``` -3. **Build**: +3. **Build with MSBuild**: - **Default build (matches your Node.js architecture):** + **Default build:** ```bash npm run build ``` - **Architecture-specific builds:** + **Common build variants:** ```bash - npm run build:x64 # 64-bit library - npm run build:x86 # 32-bit library - npm run build:arm64 # ARM64 library - npm run build:all # Build all architectures + npm run build:debug:x64 # default script target + npm run build:release:x64 + npm run build:debug:x86 + npm run build:release:x86 + npm run build:debug:arm64 + npm run build:release:arm64 + npm run build:debug:arm64ec + npm run build:release:arm64ec + npm run build:all # x64 + x86 all variants ``` - **Clean build artifacts:** + **Clean build outputs:** ```bash npm run clean ``` -The outputs will be in architecture-specific directories: +4. **(Optional) Build with node-gyp (legacy):** + + ```bash + npm run gyp:build + npm run gyp:build:x64 + npm run gyp:build:x86 + npm run gyp:build:arm64 + npm run gyp:clean + ``` + +MSBuild outputs go to Visual Studio configuration/platform output directories. node-gyp outputs are in architecture-specific directories: - `build/lib/x64/MAPIStubLibrary.lib` - 64-bit library - `build/lib/ia32/MAPIStubLibrary.lib` - 32-bit library @@ -85,9 +100,9 @@ After building with Visual Studio, you'll find: - `MAPIStubLibrary.lib` - The static library for linking - Debug symbols (if building in Debug configuration) -### Node.js Build +### Node.js (node-gyp) Build -After building with node-gyp, you'll find: +After building with node-gyp (`gyp:*` scripts), you'll find: - `MAPIStubLibrary.lib` - The static library for linking in `build/Release/` diff --git a/mapistub.sln b/mapistub.sln index 0551dde..c3692f9 100644 --- a/mapistub.sln +++ b/mapistub.sln @@ -1,7 +1,6 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.779 +# Visual Studio Version 18 +VisualStudioVersion = 18.0.0.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mapistub", "mapistub.vcxproj", "{ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}" EndProject @@ -15,10 +14,6 @@ Global Debug|Win32 = Debug|Win32 Debug|ARM64 = Debug|ARM64 Debug|ARM64EC = Debug|ARM64EC - Prefast|x64 = Prefast|x64 - Prefast|Win32 = Prefast|Win32 - Prefast|ARM64 = Prefast|ARM64 - Prefast|ARM64EC = Prefast|ARM64EC Release_Unicode|x64 = Release_Unicode|x64 Release_Unicode|Win32 = Release_Unicode|Win32 Release_Unicode|ARM64 = Release_Unicode|ARM64 @@ -45,14 +40,6 @@ Global {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Debug|ARM64.Build.0 = Debug|ARM64 {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Debug|ARM64EC.Build.0 = Debug|ARM64EC - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|x64.ActiveCfg = Prefast|x64 - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|x64.Build.0 = Prefast|x64 - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|Win32.ActiveCfg = Prefast|Win32 - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|Win32.Build.0 = Prefast|Win32 - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|ARM64.ActiveCfg = Prefast|ARM64 - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|ARM64.Build.0 = Prefast|ARM64 - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|ARM64EC.ActiveCfg = Prefast|ARM64EC - {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Prefast|ARM64EC.Build.0 = Prefast|ARM64EC {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Release_Unicode|x64.ActiveCfg = Release_Unicode|x64 {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Release_Unicode|x64.Build.0 = Release_Unicode|x64 {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C}.Release_Unicode|Win32.ActiveCfg = Release_Unicode|Win32 diff --git a/mapistub.vcxproj b/mapistub.vcxproj index 1a0a120..f6eda9c 100644 --- a/mapistub.vcxproj +++ b/mapistub.vcxproj @@ -1,4 +1,4 @@ - + @@ -20,14 +20,6 @@ Debug x64 - - Fuzz - ARM64 - - - Fuzz - ARM64EC - Fuzz Win32 @@ -36,22 +28,6 @@ Fuzz x64 - - Prefast_Unicode - Win32 - - - Prefast_Unicode - x64 - - - Prefast - Win32 - - - Prefast - x64 - Release_Unicode Win32 @@ -84,22 +60,6 @@ Debug ARM64EC - - Prefast_Unicode - ARM64 - - - Prefast_Unicode - ARM64EC - - - Prefast - ARM64 - - - Prefast - ARM64EC - Release_Unicode ARM64 @@ -120,55 +80,30 @@ {ACD4DD9F-0FB8-42C8-BC1C-25A5A29CB40C} mapistub - 10.0 StaticLibrary Unicode - v143 true - Spectre false StaticLibrary MultiByte - v143 true - Spectre - false - - - StaticLibrary - MultiByte - v143 - false - Spectre - false - - - StaticLibrary - Unicode - v143 - false - Spectre false StaticLibrary Unicode - v143 false - Spectre true StaticLibrary Unicode - v143 false - Spectre true true true @@ -176,57 +111,31 @@ StaticLibrary MultiByte - v143 false - Spectre true StaticLibrary Unicode - v143 true - Spectre false StaticLibrary MultiByte - v143 true - Spectre - false - - - StaticLibrary - MultiByte - v143 - false - Spectre - false - - - StaticLibrary - Unicode - v143 - false - Spectre false StaticLibrary Unicode - v143 false - Spectre true StaticLibrary Unicode - v143 false - Spectre true true true @@ -234,125 +143,55 @@ StaticLibrary MultiByte - v143 false - Spectre true StaticLibrary Unicode - v143 true - Spectre false StaticLibrary MultiByte - v143 true - Spectre - false - - - StaticLibrary - MultiByte - v143 - false - Spectre - false - - - StaticLibrary - Unicode - v143 - false - Spectre false StaticLibrary Unicode - v143 false - Spectre true - - StaticLibrary - Unicode - v143 - false - Spectre - true - true - true - StaticLibrary MultiByte - v143 false - Spectre true StaticLibrary Unicode - v143 true - Spectre false StaticLibrary MultiByte - v143 true - Spectre - false - - - StaticLibrary - MultiByte - v143 - false - Spectre - false - - - StaticLibrary - Unicode - v143 - false - Spectre false StaticLibrary Unicode - v143 false - Spectre true - - StaticLibrary - Unicode - v143 - false - Spectre - true - true - true - StaticLibrary MultiByte - v143 false - Spectre true @@ -366,12 +205,6 @@ - - - - - - @@ -387,12 +220,6 @@ - - - - - - @@ -408,18 +235,9 @@ - - - - - - - - - @@ -429,18 +247,9 @@ - - - - - - - - - @@ -460,14 +269,6 @@ true - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - @@ -477,14 +278,6 @@ true - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - @@ -497,14 +290,6 @@ true - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - @@ -513,14 +298,6 @@ true - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - - - true - ..\.gdn\i\nuget\Microsoft.Security.CodeAnalysis.PREfast.Cli.win-x64.1.6.0\tools\Sdl.Recommended.Warning.ruleset - @@ -533,15 +310,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -564,15 +337,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -594,15 +363,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -625,15 +390,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -656,15 +417,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -686,15 +443,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -716,73 +469,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;%(PreprocessorDefinitions) - - - /safeseh %(AdditionalOptions) - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;%(PreprocessorDefinitions) - - - /safeseh %(AdditionalOptions) - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest Guard @@ -803,71 +494,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;_WIN64;%(PreprocessorDefinitions) - - - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;_WIN64;%(PreprocessorDefinitions) - - - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest Guard @@ -887,15 +518,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest Guard @@ -916,15 +543,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest Guard @@ -944,15 +567,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -975,15 +594,11 @@ true MultiThreaded true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -1005,46 +620,11 @@ true MultiThreaded true - Level4 - true - ProgramDatabase - true - true - true - Default - true - stdcpplatest - Guard - - - _AFXDLL;NDEBUG;_WIN64;%(PreprocessorDefinitions) - - - /safeseh %(AdditionalOptions) - true - Windows - true - true - true - - - - - MaxSpeed - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;UNICODE;%(PreprocessorDefinitions) - true - MultiThreaded - true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -1067,45 +647,11 @@ true MultiThreaded true - Level4 - true - ProgramDatabase - true - true - true - Default - true - stdcpplatest - Guard - - - _AFXDLL;NDEBUG;_WIN64;%(PreprocessorDefinitions) - - - true - Windows - true - true - true - - - - - MaxSpeed - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;UNICODE;%(PreprocessorDefinitions) - true - MultiThreaded - true - Level4 - true ProgramDatabase true - true true Default true - stdcpplatest Guard @@ -1127,73 +673,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;_WIN64;%(PreprocessorDefinitions) - - - /safeseh %(AdditionalOptions) - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;_WIN64;%(PreprocessorDefinitions) - - - /safeseh %(AdditionalOptions) - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest Guard @@ -1214,71 +698,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;_WIN64;%(PreprocessorDefinitions) - - - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest - Guard - - - _AFXDLL;_DEBUG;_WIN64;%(PreprocessorDefinitions) - - - true - Windows - true - - - - - Disabled - $(SolutionDir)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - MultiThreadedDebug - true - Level4 - true - ProgramDatabase - true - true - true - false - false - stdcpplatest Guard @@ -1298,15 +722,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest Guard @@ -1327,15 +747,11 @@ true MultiThreadedDebug true - Level4 - true ProgramDatabase true - true false EnableFastChecks false - stdcpplatest Guard diff --git a/package.json b/package.json index 0ea5e08..7ec9f24 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,44 @@ "version": "1.0.0", "description": "MAPI Stub Library for 32 and 64 bit applications", "scripts": { - "build": "node-gyp rebuild", - "build:x64": "node-gyp configure --arch=x64 && node-gyp build --arch=x64", - "build:x86": "node-gyp configure --arch=ia32 && node-gyp build --arch=ia32", - "build:arm64": "node-gyp configure --arch=arm64 && node-gyp build --arch=arm64", - "build:all": "npm run build:x64 && npm run build:x86 && npm run build:arm64", - "clean": "node-gyp clean", - "clean:all": "node-gyp clean && rmdir /s /q build 2>nul || true" + "msbuild": "powershell -NoProfile -ExecutionPolicy Bypass -Command \"$pf86 = ${env:ProgramFiles(x86)}; $vswhere = Join-Path $pf86 'Microsoft Visual Studio\\Installer\\vswhere.exe'; if (-not (Test-Path $vswhere)) { Write-Error 'vswhere.exe not found. Install Visual Studio Build Tools or Visual Studio.'; exit 1 }; $vsPath = & $vswhere -latest -requires Microsoft.Component.MSBuild -property installationPath; if (-not $vsPath) { Write-Error 'MSBuild not found via vswhere.'; exit 1 }; $msbuild = Join-Path $vsPath 'MSBuild\\Current\\Bin\\amd64\\MSBuild.exe'; if (-not (Test-Path $msbuild)) { Write-Error ('MSBuild.exe not found at ' + $msbuild); exit 1 }; & $msbuild @args\"", + + "build": "npm run build:debug:x64", + "build:debug": "npm run build:debug:x64", + "build:debug:x64": "npm run msbuild -- mapistub.sln /m /p:Configuration=Debug_Unicode /p:Platform=x64", + "build:debug:x86": "npm run msbuild -- mapistub.sln /m /p:Configuration=Debug_Unicode /p:Platform=Win32", + "build:release": "npm run build:release:x64", + "build:release:x64": "npm run msbuild -- mapistub.sln /m /p:Configuration=Release_Unicode /p:Platform=x64", + "build:release:x86": "npm run msbuild -- mapistub.sln /m /p:Configuration=Release_Unicode /p:Platform=Win32", + + "build:debug:ansi": "npm run build:debug:ansi:x64", + "build:debug:ansi:x64": "npm run msbuild -- mapistub.sln /m /p:Configuration=Debug /p:Platform=x64", + "build:debug:ansi:x86": "npm run msbuild -- mapistub.sln /m /p:Configuration=Debug /p:Platform=Win32", + "build:release:ansi": "npm run build:release:ansi:x64", + "build:release:ansi:x64": "npm run msbuild -- mapistub.sln /m /p:Configuration=Release /p:Platform=x64", + "build:release:ansi:x86": "npm run msbuild -- mapistub.sln /m /p:Configuration=Release /p:Platform=Win32", + + "build:all": "npm run build:all:x64 && npm run build:all:x86", + "build:all:x64": "npm run build:debug:x64 && npm run build:release:x64 && npm run build:debug:ansi:x64 && npm run build:release:ansi:x64", + "build:all:x86": "npm run build:debug:x86 && npm run build:release:x86 && npm run build:debug:ansi:x86 && npm run build:release:ansi:x86", + + "build:debug:arm64": "npm run msbuild -- mapistub.sln /m /p:Configuration=Debug_Unicode /p:Platform=ARM64", + "build:release:arm64": "npm run msbuild -- mapistub.sln /m /p:Configuration=Release_Unicode /p:Platform=ARM64", + "build:all:arm64": "npm run build:debug:arm64 && npm run build:release:arm64", + + "build:debug:arm64ec": "npm run msbuild -- mapistub.sln /m /p:Configuration=Debug_Unicode /p:Platform=ARM64EC", + "build:release:arm64ec": "npm run msbuild -- mapistub.sln /m /p:Configuration=Release_Unicode /p:Platform=ARM64EC", + "build:all:arm64ec": "npm run build:debug:arm64ec && npm run build:release:arm64ec", + + "clean": "npm run msbuild -- mapistub.sln /t:Clean", + "clean:gyp": "npm run gyp:clean", + "clean:all": "npm run clean && npm run clean:gyp", + + "gyp:build": "node-gyp rebuild", + "gyp:build:x64": "node-gyp configure --arch=x64 && node-gyp build --arch=x64", + "gyp:build:x86": "node-gyp configure --arch=ia32 && node-gyp build --arch=ia32", + "gyp:build:arm64": "node-gyp configure --arch=arm64 && node-gyp build --arch=arm64", + "gyp:clean": "node-gyp clean" }, "devDependencies": { "clang-format": "^1.8.0" diff --git a/scripts/install-winsdk.ps1 b/scripts/install-winsdk.ps1 new file mode 100644 index 0000000..efdcdea --- /dev/null +++ b/scripts/install-winsdk.ps1 @@ -0,0 +1,42 @@ +param( + [string]$SdkVersion = "10.0.22621.0", + [string]$DownloadUrl = "https://go.microsoft.com/fwlink/?linkid=2196241", + [string]$ExpectedHash = "73FE3CC0E50D946D0C0A83A1424111E60DEE23F0803E305A8974A963B58290C0" +) + +$ErrorActionPreference = "Stop" + +$sdkPath = Join-Path "${env:ProgramFiles(x86)}\Windows Kits\10\Include" $SdkVersion +if (Test-Path $sdkPath) { + Write-Host "Windows SDK $SdkVersion already installed" + exit 0 +} + +$installer = Join-Path $env:TEMP "winsdksetup.exe" +$logPath = Join-Path $env:TEMP "sdk_install.log" + +Write-Host "Downloading Windows 11 SDK $SdkVersion..." +Invoke-WebRequest -Uri $DownloadUrl -OutFile $installer + +$actualHash = (Get-FileHash -Path $installer -Algorithm SHA256).Hash +if ($actualHash -ne $ExpectedHash) { + Write-Error "SHA256 hash mismatch! Expected: $ExpectedHash, Got: $actualHash" + exit 1 +} +Write-Host "SHA256 verified: $actualHash" + +Write-Host "Installing SDK (this may take a few minutes)..." +$proc = Start-Process -FilePath $installer -ArgumentList "/features OptionId.DesktopCPPx64 OptionId.DesktopCPPx86 OptionId.DesktopCPParm64 /quiet /norestart /log `"$logPath`"" -Wait -PassThru +if ($proc.ExitCode -ne 0) { + Get-Content $logPath -ErrorAction SilentlyContinue | Select-Object -Last 50 + Write-Error "Windows SDK installer exited with code $($proc.ExitCode)" + exit 1 +} + +if (!(Test-Path $sdkPath)) { + Get-Content $logPath -ErrorAction SilentlyContinue | Select-Object -Last 50 + Write-Error "Windows SDK installation failed" + exit 1 +} + +Write-Host "Windows SDK $SdkVersion installed successfully"