Skip to content

Commit cd32b44

Browse files
authored
use CimGetVerificationInformation from cimwriter.dll (microsoft#2608)
Signed-off-by: Maksim An <maksiman@microsoft.com>
1 parent 0e46ce2 commit cd32b44

3 files changed

Lines changed: 46 additions & 16 deletions

File tree

internal/winapi/cimfs.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ func CimSealImage(blockCimPath string, hashSize *uint64, fixedHeaderSize *uint64
148148
}
149149

150150
func CimGetVerificationInformation(blockCimPath string, isSealed *uint32, hashSize *uint64, signatureSize *uint64, fixedHeaderSize *uint64, hash *byte, signature *byte) (hr error) {
151-
return cimfs.CimGetVerificationInformation(blockCimPath, isSealed, hashSize, signatureSize, fixedHeaderSize, hash, signature)
151+
return pickSupported(
152+
cimwriter.CimGetVerificationInformation,
153+
cimfs.CimGetVerificationInformation,
154+
)(blockCimPath, isSealed, hashSize, signatureSize, fixedHeaderSize, hash, signature)
152155
}
153156

154157
func CimMountVerifiedImage(imagePath string, fsName string, flags uint32, volumeID *guid.GUID, hashSize uint16, hash *byte) error {

internal/winapi/cimwriter/cimwriter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ type ImagePath = types.CimFsImagePath
3434
//sys CimCreateMergeLink(cimFSHandle FsHandle, newPath string, oldPath string) (hr error) = cimwriter.CimCreateMergeLink?
3535
//sys CimSealImage(blockCimPath string, hashSize *uint64, fixedHeaderSize *uint64, hash *byte) (hr error) = cimwriter.CimSealImage?
3636

37+
//sys CimGetVerificationInformation(blockCimPath string, isSealed *uint32, hashSize *uint64, signatureSize *uint64, fixedHeaderSize *uint64, hash *byte, signature *byte) (hr error) = cimwriter.CimGetVerificationInformation?
38+
3739
var load = sync.OnceValue(func() error {
3840
// Pre-load the DLL with a restricted search path (System32 + application directory only)
3941
// to prevent loading from untrusted locations (e.g., CWD or arbitrary PATH entries).

internal/winapi/cimwriter/zsyscall_windows.go

Lines changed: 40 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)