search for: get_last_error

Displaying 20 results from an estimated 43 matches for "get_last_error".

2007 Oct 04
0
Prototyping the Dir class
...#39;USERPROFILE/HOME not set'' end end dir = buf.unpack("Z*")[0] end if block_given? begin buf = 0.chr * MAX_PATH if GetCurrentDirectory(buf.length, buf) == 0 raise ArgumentError, get_last_error else # MSDN says the drive letter could be dropped, # and that GetFullPathName should be called just in case. current = buf.unpack("Z*")[0] buf2 = 0.chr * MAX_PATH if GetFullPathName(current, buf...
2006 Mar 25
1
Help with File.set_permissions port
I''ve got a (broken) version of File.set_permissions in CVS, and I need some help finishing it off please. Heesob, can you take a look? Thanks, Dan
2008 Jun 18
2
[ win32utils-Bugs-20722 ] Windows::Error.get_last_error only returns the first character (PATCH)
...at 2008-06-18 15:16 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=20722&group_id=85 Category: windows-pr Group: Code Status: Open Resolution: None Priority: 3 Submitted By: John Whitley (whitley) Assigned to: Nobody (None) Summary: Windows::Error.get_last_error only returns the first character (PATCH) Initial Comment: Platform/version info: Windows XP SP3, ruby 1.8.6-p114, windows-pr-0.8.6 Repro code: require ''windows/error'' class ErrTest; include Windows::Error; end et = ErrTest.new puts et.get_last_error(100) Expected result (on eng...
2006 May 26
13
win32-dir, unicode
Hi, I''ve got a preliminary version of the pure Ruby version of win32-dir in CVS. However, I was hoping to work out the Unicode issue. Run this: from = "C:\\test" to = "?????" Dir.mkdir(from) unless File.exists?(from) Dir.create_junction(to, from) It works, but my explorer (and dos) window shows the name garbled. I don''t think it''s a font
2006 Mar 20
5
Need some ACL help for win32-file
...bool = @@GetFileSecurity.call( file, DACL_SECURITY_INFORMATION, sec_buf, sec_buf.length, length_needed ) if bool == 0 && @@GetLastError.call != ERROR_INSUFFICIENT_BUFFER raise ArgumentError, get_last_error end break if sec_buf.length >= length_needed.unpack(''L'').first sec_buf += '' '' * length_needed.unpack("L").first end control = [0].pack(''L'') revision = [0].pack(''L'...
2007 Sep 25
2
Using callbacks with ReadFileEx
...handle = CreateFile( file, FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, 0 ) if handle == INVALID_HANDLE_VALUE raise Error, get_last_error end func = Win32::API::Callback.new(''LLP'', ''V''){ block.call } overlapped = 0.chr * 20 if offset > 0 overlapped[8,4] = [offset].pack(''L'') # OVERLAPPED.Offset...
2008 May 06
4
DeviceIoControl + IOCTL_DISK_GET_DRIVE_GEOMETRY problem
...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, buf.size, bytes, 0 ) # Fails here unless bool puts "DeviceIoControl failed: " + get_last_error fh.close exit End fh.close Thanks, Dan PS - I''ve added several IOCTL macro methods to Windows::DeviceIO in CVS (part of windows-pr). This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is str...
2008 Jul 08
12
Some more win32-security: SID.create
Hi all, How does this look as a general approach to a SID.create method: # Creates and initializes def self.create(authority, *sub_authorities) if sub_authorities.length > 8 raise ArgumentError, ''maximum of 8 subauthorities allowed'' end authorities = Array.new(8, 0) authorities.replace(sub_authorities) count = authorities.select{ |e| e > 0 }.size
2008 Nov 22
2
GetFinalPathNameByHandle for XP and earlier
...e ignored, but are # present in order to keep the function parameters identical # to the function defined for Windows Vista and later. # def GetFinalPathNameByHandle(handle, buf, buf_size, flags) size_ptr = [0].pack(''Q'') unless GetFileSizeEx(handle, size_ptr) raise get_last_error end if size_ptr.unpack(''Q'')[0] <= 0 raise ''file size must be greater than zero'' end map = CreateFileMapping(handle, nil, PAGE_READONLY, 0, 1, nil) final_path = nil if map && map > 0 pmem = MapViewOfFile(map,...
2008 May 17
2
Problem reading log with win32-eventlog - buffer too small
Hi all, A user recently ran into an issue with win32-eventlog and the EventLog#read method when reading a saved log file. It seems that there''s an issue. After some experimentation I found that the problem seems to be that the initial buffer to ReadEventLog() in line 558 is too small, so it tries a second call to ReadEventLog() with a larger buffer. The problem is that, after I
2008 May 18
2
Pure win32-thread library?
...WinThreadFunc, # Pointer to thread func dwArgs, # Arguments passed to thread func 0, # Execute immediately, i.e. not suspended thread_id # Stores the thread id ) if @thread == 0 raise Error, get_last_error end @thread_id = thread_id.unpack(''L'')[0] end def join(limit = INFINITE) limit = limit * 1000 unless limit == INFINITE WaitForSingleObject(@thread, limit) ReleaseMutex(@@mutex) end def terminate...
2011 Feb 08
2
WSAStartup failure
...require ''windows/error'' require ''windows/system_info'' include Windows::WSA include Windows::Error include Windows::SystemInfo begin version = MAKEWORD(2,2) buffer = 0.chr * 532 err = WSAStartup(version, buffer) if err != 0 puts "Oops: " + get_last_error(err) end ensure WSACleanup() end
2009 Aug 02
2
win32-security, 1.9.x, encoding issue?
....rb:62:in `test_string_to_sid'' Where line 111 is the last line of this: def self.string_to_sid(string) sid_buf = 0.chr * 80 string_addr = [string].pack(''p*'').unpack(''L'')[0] unless ConvertStringSidToSid(string_addr, sid_buf) raise Error, get_last_error end sid_buf.strip end I searched on the web but I wasn''t really sure what the best or correct solution was. I really hope we don''t have to mess around with file encodings. Regards, Dan
2007 Oct 01
2
[ win32utils-Bugs-14360 ] Bad interaction between win32-file-stat and FileUtils
Bugs item #14360, was opened at 2007-10-01 15:00 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=14360&group_id=85 Category: win32-file-stat Group: Code Status: Open Resolution: None Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Bad interaction between win32-file-stat and FileUtils Initial Comment: Ruby
2007 Nov 28
4
Can''t write to "Windows PowerShell" source with win32-eventlog
Hi all, Tim Uckun reported, and I''ve confirmed, that you can''t write to the Windows PowerShell event source for some reason. Tim thought it might be because of the space in the name, but my attempt to quote it did not seem to help. In order to follow along, install PowerShell, create the foo.dll using the foo.mc file in the ''test'' directory, and try the
2007 Oct 08
1
Getting an actual system error
Heya all, I don''t think I''ve been paying attention. When a Windows API function fails, I could have been doing this: raise SystemCallError(GetLastError()) Instead of this: # Where ''Error'' is nested under the current class. raise Error, get_last_error I''m not sure how big of a deal this is in practice, however, or if it''s even preferred for our purposes. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohib...
2007 Oct 27
0
Who wants to take a stab at IO.foreach?
...esting purposes def self.foreach(file, sep="\r\n") handle = CreateFile( file, FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0 ) if handle == INVALID_HANDLE_VALUE raise Error, get_last_error end buffer = 0.chr * MAX_READ nbytes = [0].pack(''L'') offset = 0 olap = 0.chr * 20 # sizeof(OVERLAPPED) while bool = ReadFile(handle, buffer, buffer.size, nbytes, olap) error = GetLastError() if !bool && erro...
2006 Oct 17
3
Printing Support
Printing support is added to the repository (as you have seen / will see). Kudos to Sean for tackling such a big bear. I''ll work on adding the two dialogs to bigdemo later unless Sean tackles it first. Roy
2010 Nov 04
1
Fwd: win32/process - small bug?
It might be a bit before I can get to this, so I thought I''d pass it on. Also, while I was stuck in the airport in Minneapolis, I decided that the getrlimit method should be refactored to remove the process from the job (if it wasn''t already in one) after it''s finished, if possible. Dan ---------- Forwarded message ---------- From: Ben Nagy <ben.nagy.web at
2006 May 21
6
Possible problems with EventLog#write
Hi, I''ve got EventLog#write and EventLog.add_event_source methods done. Well, I *think* they''re done, but I can''t get the data (text) to work properly, and I''m not sure if it''s a bug in my .mc file, the add_event_source method, the write method, or just a goof in my test file. The source, category and event id seem to be ok. However, the