This commit is contained in:
bluepython508 committed 2026-10-22 12:27:19 +01:00
1 parent 3530afb854
commit 6903fcff27
2146 files changed
+112256 -190703

No files matched your search

+3 -3
View File
@@ -50,8 +50,8 @@ func (bs *BSTR) String() string {
return windows.UTF16ToString(bs.toUTF16())
}
// toUTF16 is unsafe for general use because it returns a pointer that is
// not managed by the Go GC.
// toUTF16 is unsafe for general use because it returns a slice referencing a
// pointer that is not managed by the Go GC.
func (bs *BSTR) toUTF16() []uint16 {
return unsafe.Slice(bs.toUTF16Ptr(), bs.Len())
}
@@ -67,7 +67,7 @@ func (bs *BSTR) toUTF16Ptr() *uint16 {
return (*uint16)(unsafe.Pointer(*bs))
}
// ToUTF16 returns the contents of bs as C-style string pointer to UTF-16 code units.
// ToUTF16Ptr returns the contents of bs as C-style string pointer to UTF-16 code units.
func (bs *BSTR) ToUTF16Ptr() *uint16 {
return unsafe.SliceData(bs.ToUTF16())
}
+4 -4
View File
@@ -47,24 +47,24 @@ var (
)
func sysAllocString(str *uint16) (ret BSTR) {
r0, _, _ := syscall.Syscall(procSysAllocString.Addr(), 1, uintptr(unsafe.Pointer(str)), 0, 0)
r0, _, _ := syscall.SyscallN(procSysAllocString.Addr(), uintptr(unsafe.Pointer(str)))
ret = BSTR(r0)
return
}
func sysAllocStringLen(str *uint16, strLen uint32) (ret BSTR) {
r0, _, _ := syscall.Syscall(procSysAllocStringLen.Addr(), 2, uintptr(unsafe.Pointer(str)), uintptr(strLen), 0)
r0, _, _ := syscall.SyscallN(procSysAllocStringLen.Addr(), uintptr(unsafe.Pointer(str)), uintptr(strLen))
ret = BSTR(r0)
return
}
func sysFreeString(bstr BSTR) {
syscall.Syscall(procSysFreeString.Addr(), 1, uintptr(bstr), 0, 0)
syscall.SyscallN(procSysFreeString.Addr(), uintptr(bstr))
return
}
func sysStringLen(bstr BSTR) (ret uint32) {
r0, _, _ := syscall.Syscall(procSysStringLen.Addr(), 1, uintptr(bstr), 0, 0)
r0, _, _ := syscall.SyscallN(procSysStringLen.Addr(), uintptr(bstr))
ret = uint32(r0)
return
}