2019-07-01 17:45:55 +02:00
|
|
|
module os
|
|
|
|
|
|
|
|
// Ref - https://docs.microsoft.com/en-us/windows/desktop/winprog/windows-data-types
|
|
|
|
// A handle to an object.
|
2019-07-02 21:45:51 +02:00
|
|
|
/*
|
2019-07-01 17:45:55 +02:00
|
|
|
type HANDLE voidptr // C.HANDLE
|
|
|
|
|
|
|
|
pub fn get_file_handle(path string) HANDLE {
|
2019-07-01 21:31:36 +02:00
|
|
|
mode := 'rb'
|
2019-07-01 17:45:55 +02:00
|
|
|
_fh := C.fopen(path.cstr(), mode.cstr())
|
|
|
|
if isnil(_fh) {
|
|
|
|
return HANDLE(INVALID_HANDLE_VALUE)
|
|
|
|
}
|
|
|
|
_handle := C._get_osfhandle(C._fileno(_fh)) // CreateFile? - hah, no -_-
|
|
|
|
return _handle
|
|
|
|
}
|
2019-07-02 21:45:51 +02:00
|
|
|
*/
|