From 7e4a682ef33febb1173b3de25167df3db3c6617d Mon Sep 17 00:00:00 2001 From: mertakman Date: Wed, 18 Dec 2024 12:58:32 +0000 Subject: [PATCH] fix:do not export formatmessage --- internal/bcrypt/ntstatus.go | 4 ++-- internal/bcrypt/zsyscall_windows.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/bcrypt/ntstatus.go b/internal/bcrypt/ntstatus.go index ba91a1f..5f23bd4 100644 --- a/internal/bcrypt/ntstatus.go +++ b/internal/bcrypt/ntstatus.go @@ -25,7 +25,7 @@ func langID(pri, sub uint16) uint32 { return uint32(sub)<<10 | uint32(pri) } func (s NTStatus) Error() string { b := make([]uint16, 300) - n, err := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY, modntdll.Handle(), uint32(s), langID(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil) + n, err := formatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY, modntdll.Handle(), uint32(s), langID(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil) if err != nil { return fmt.Sprintf("NTSTATUS 0x%08x", uint32(s)) } @@ -39,4 +39,4 @@ func (s NTStatus) Error() string { //sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb // windows api calls -//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW +//sys formatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW diff --git a/internal/bcrypt/zsyscall_windows.go b/internal/bcrypt/zsyscall_windows.go index a037445..5d049f0 100644 --- a/internal/bcrypt/zsyscall_windows.go +++ b/internal/bcrypt/zsyscall_windows.go @@ -392,7 +392,7 @@ func VerifySignature(hKey KEY_HANDLE, pPaddingInfo unsafe.Pointer, pbHash []byte return } -func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) { +func formatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) { var _p0 *uint16 if len(buf) > 0 { _p0 = &buf[0]