"Shashank Date" <sdate / everestkc.net> wrote in message
> Like I said earlier, this did not work for me. I guess this is because of
> lines such as
>
>                 szServer = (LPCWSTR)STR2CSTR(server);
>
> in your code. I think STR2CSTR returns regular C strings (char *) not
> unicode (wchar_t *) strings. Is there a way to convert regular strings to
> unicode in Ruby ?

Ok, I changed your code
from :

   if(server != Qnil){
      szServer = (LPCWSTR)STR2CSTR(server);
   }
   else{
      szServer = NULL;
   }

to
   if(server != Qnil){
      wchar_t wszTemp[MAX_PATH];
      mbstowcs(wszTemp, STR2CSTR(server), MAX_PATH);
      szServer = (LPCWSTR)wszTemp;
   }
   else{
      szServer = NULL;
   }

And now it is working fine except this line:

  p Win32Etc.getgrgid(500,"\\\\MYMACHINE")

It gives error as follows:

C:/atest/tst_win_etc.rb:10:in `getgrgid': can't find group for 500
(ArgumentError)
 from C:/atest/tst_win_etc.rb:10

What's with group 500 ? I tried 500, 501, 510, etc but to no vail.

HTH,
-- shanko