|
|
@@ -60,6 +60,7 @@ var (
|
|
|
procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
|
|
|
procDeleteFileW = modkernel32.NewProc("DeleteFileW")
|
|
|
procMoveFileW = modkernel32.NewProc("MoveFileW")
|
|
|
+ procMoveFileExW = modkernel32.NewProc("MoveFileExW")
|
|
|
procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
|
|
|
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
|
|
|
procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
|
|
|
@@ -169,6 +170,9 @@ var (
|
|
|
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
|
|
procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes")
|
|
|
procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW")
|
|
|
+ procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
|
|
|
+ procGetACP = modkernel32.NewProc("GetACP")
|
|
|
+ procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar")
|
|
|
procTranslateNameW = modsecur32.NewProc("TranslateNameW")
|
|
|
procGetUserNameExW = modsecur32.NewProc("GetUserNameExW")
|
|
|
procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
|
|
|
@@ -700,6 +704,18 @@ func MoveFile(from *uint16, to *uint16) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
|
|
|
+ r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
|
|
|
+ if r1 == 0 {
|
|
|
+ if e1 != 0 {
|
|
|
+ err = error(e1)
|
|
|
+ } else {
|
|
|
+ err = syscall.EINVAL
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetComputerName(buf *uint16, n *uint32) (err error) {
|
|
|
r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
|
|
|
if r1 == 0 {
|
|
|
@@ -1996,6 +2012,33 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
|
|
+ r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
|
|
+ if r0 != 0 {
|
|
|
+ errcode = syscall.Errno(r0)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func GetACP() (acp uint32) {
|
|
|
+ r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
|
|
|
+ acp = uint32(r0)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+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 {
|
|
|
+ err = syscall.EINVAL
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
|
|
|
r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
|
|
|
if r1&0xff == 0 {
|