[ANN] sys-win32etc 0.0.4

Hi all,

I’m happy to announce the release of sys-win32etc 0.0.4. This module
provides Etc module functionality for Win32.

What’s significant about this release? The last of the memory leaks have
been cleaned up! In addition, server names (if provided) are now
automatically prepended with a ‘\’. So now you only need provide
"\some_server <\some_server> " instead of "\\some_server
<\\some_server> ".

However, there is still one issue to work out. See the "Help Wanted"
section below.

Synopsis

···

=======
require “win32etc”

p Win32Etc.login
p Win32Etc.getpwnam(“Guest”)
p Win32Etc.getpwuid(500)
p Win32Etc.getgrnam(“Guests”)
p Win32Etc.getgrgid(512)

Win32Etc.group{ |g|
p g
}

Win32Etc.passwd{ |pw|
p pw
}

HELP WANTED

Testing is much appreciated, especially for the optional server name.

Contrary to what I said in the docs, there is still one remaining issue.
For reasons I cannot determine, the current code results in a segfault when
run in conjunction with TestUnit (at least, it does on my WinXP Pro box).
However, the vanilla test script (test.rb) works fine. Help on this
peculiarity is definitely wanted.

Meanwhile, enjoy!

Regards,

Dan

Hi,

···

----- Original Message -----
From: “Berger, Daniel” djberge@qwest.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Friday, September 05, 2003 6:19 AM
Subject: [ANN] sys-win32etc 0.0.4

HELP WANTED

Testing is much appreciated, especially for the optional server name.

Contrary to what I said in the docs, there is still one remaining issue.
For reasons I cannot determine, the current code results in a segfault
when
run in conjunction with TestUnit (at least, it does on my WinXP Pro box).
However, the vanilla test script (test.rb) works fine. Help on this
peculiarity is definitely wanted.

I think It’s due to invalid struct allocation method.
Try following patch.

===============================================================
@@ -103,8 +103,10 @@
// This portion of code taken partially from a post by Shashank Date.
// Also, the server name is automatically prepended to the server name
// strictly for convenience.

  • wchar_t wszTemp[MAX_PATH];
  • gstruct = rb_struct_new(GroupStruct);
    if(tserver != Qnil){
  •  wchar_t wszTemp[MAX_PATH];
    
  •  VALUE server = rb_str_new2("\\\\");
     rb_str_concat(server,tserver);
     mbstowcs(wszTemp, STR2CSTR(server), MAX_PATH);
    

@@ -309,9 +311,11 @@

VALUE r_auth_flags = rb_ary_new();
VALUE uid = Qnil;
  • wchar_t wszTemp[MAX_PATH];

  • pstruct = rb_struct_new(PasswdStruct);
    if(tserver != Qnil){

  •  wchar_t wszTemp[MAX_PATH];
    
  •  VALUE server = rb_str_new2("\\\\");
     rb_str_concat(server,tserver);
    

================================================================

Regards,

Park Heesob