You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
348 B
20 lines
348 B
7 years ago
|
package update
|
||
|
|
||
|
import (
|
||
|
"syscall"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
func hideFile(path string) error {
|
||
|
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
||
|
setFileAttributes := kernel32.NewProc("SetFileAttributesW")
|
||
|
|
||
|
r1, _, err := setFileAttributes.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(path))), 2)
|
||
|
|
||
|
if r1 == 0 {
|
||
|
return err
|
||
|
} else {
|
||
|
return nil
|
||
|
}
|
||
|
}
|