Displaying 3 results from an estimated 3 matches for "get_osfhandle".
Did you mean:
_get_osfhandle
2008 May 06
4
DeviceIoControl + IOCTL_DISK_GET_DRIVE_GEOMETRY problem
...ing wrong here?
require ''windows/device_io''
require ''windows/handle''
require ''windows/error''
include Windows::DeviceIO
include Windows::Handle
include Windows::Error
fh = File.open(''test.txt'') # Assume you have this
handle = get_osfhandle(fh.fileno)
if handle == INVALID_HANDLE_VALUE
puts "get_osfhandle failed"
fh.close
exit
end
buf = 0.chr * 24 # sizeof(DISK_GEOMETRY)
bytes = [0].pack(''L'')
bool = DeviceIoControl(
handle,
IOCTL_DISK_GET_DRIVE_GEOMETRY(), # 458752
nil,
0,
buf,...
2008 Apr 30
8
Playing with NtQueryInformationFile
...9;, ''L'',
''ntdll'')
# http://msdn.microsoft.com/en-us/library/cc232064.aspx
FileNameInformation = 9
FileStandardInformation = 5
STATUS_SUCCESS = 0
fh = File.open(''test.txt'', ''w'')
fh.puts "hello"
handle = get_osfhandle(fh.fileno)
if handle == INVALID_HANDLE_VALUE
puts "ERROR, get_osfhandle() : " + get_last_error
fh.close rescue nil
File.delete(''test.txt'')
exit
end
# Excessive but harmless (?)
io_status_block = 0.chr * 512
file_information = 0.chr * 512
status = NtQueryI...
2006 Nov 21
3
Fw: re. win32-process
Hi all,
Any ideas for the question below? I know how to do this in theory - make the ''inherit'' flag true, and set the ''stdout'' and ''stderr'' startf_flags hash options to something in the startup_info hash, but I wasn''t sure how to do this in practice.
It would be nice if the answer could be something like this:
require