return MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING)
}
-//sys GetACP() (acp uint, err error) = kernel32.GetACP
-//sys MultiByteToWideChar(codePage uint, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int, err error) = kernel32.MultiByteToWideChar
+//sys GetACP() (acp uint32) = kernel32.GetACP
+//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
return
}
-func MultiByteToWideChar(codePage uint, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int, err error) {
- r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
- nwrite = int(r0)
- if nwrite == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
+func GetACP() (acp uint32) {
+ r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
+ acp = uint32(r0)
return
}
-func GetACP() (acp uint, err error) {
- r0, _, e1 := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
- acp = uint(r0)
- if acp == 0 {
+func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
+ r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
+ nwrite = int32(r0)
+ if nwrite == 0 {
if e1 != 0 {
err = error(e1)
} else {
if len(b) > 0 {
pmb = &mbytes[0]
}
- acp, err := windows.GetACP()
- if err != nil {
- return 0, err
- }
+ acp := windows.GetACP()
nwc, err := windows.MultiByteToWideChar(acp, 2, pmb, int32(nmb), nil, 0)
if err != nil {
return 0, err