• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

How to get the novell username

I want to get the novell username.
0
WiseGuy
Asked:
WiseGuy
  • 3
  • 3
  • 2
1 Solution
 
lguiCommented:
Simple.

Go to developer.novell.com and download the Novell LIB for Delphi.

With it you can get the username and many other informations.

0
 
intheCommented:
hi wiseguy ,
here some codes i saved form ages ago i think from "unoffical delphi developers faq" originally:

You can try this code. I've been using it on a Netware LAN for some time now with no problems. It depends on having the NWCALLS.DLL library already on the users machine; if users have a Netware connection, then they should already have that DLL.


--------------------------------------------------------------------------------

unit GetLogin;

{This unit is a wrapper for several external functions in the NWCALLS.DLL}
{Adapted by Ray Buck from code written by Gregory Trubetskoy}
{The unit contains a function that returns the Netware User ID}
{and one that returns the user's full name.}

interface
 uses
  SysUtils, Messages, Dialogs;
function GetUserLogin: string;
function GetUserFullName( SomeUser: string): string;

implementation
  type
    NWTimeStamp = record
      Year:      byte;
      Month:     byte;
      Day:       byte;
      Hour:      byte;
      Minute:    byte;
      Second:    byte;
      DayOfWeek: byte;
    end;

  {Netware API's - require NWCALLS.DLL}
  function NWGetDefaultConnectionID(var Connection: word): word;
           far; external 'NWCALLS';

  function NWGetConnectionNumber(Connection: word; var ConnectionNumber:
word): word;
           far; external 'NWCALLS';

  function NWGetConnectionInformation(Connection: word;
                                      ConnectionNumber: word;
                                      ObjectName: pchar;
                                      var ObjectType: word;
                                      var ObjectID: word;
                                      var LoginTime: NWTimeStamp):word;
           far; external 'NWCALLS';

  function NWReadPropertyValue(Connection:       word;
                               ObjectName:       pChar;
                               ObjectType:       word;
                               PropertyName:     pChar;
                               DataSetIndex:     byte;
                               DataBuffer:       pChar;
                               var More:             byte;
                               var Flags:            byte): word;
           far; external 'NWCALLS';
  { end of Netware API stuff }

function GetUserLogin: string;
var
  ConnectionID: word;
  ConnectionNumber: word;
  RC: word;
  Name: array[0..50] of Char;
  ObjectType: word;
  ObjectID: word;
  LoginTime: NWTimeStamp;
begin
  RC := NWGetDefaultConnectionID(ConnectionID);
  RC := NWGetConnectionNumber(ConnectionID, ConnectionNumber);
  RC := NWGetConnectionInformation( ConnectionID,
                                    ConnectionNumber,
                                    Name,
                                    ObjectType,
                                    ObjectID,
                                    LoginTime);

  Result := StrPas(Name);
end;

function GetUserFullName( SomeUser: string): string;
{The real user name is a 'property' called 'IDENTIFICATON'.
You have to call NWReadPropertyValue passing it (among other things) your ConnectionID,
the name of the object (same as the login of the user who's full name you need)
and the name property you want to retrieve, in this case 'IDENTIFICATION'
(which translated from Novellish to English means 'Full Name').}

var
  ConnectionID: word;
  RC: word;
  Name: array[0..50] of Char;
  ObjectType: word;
  PropName: array[0..14] of Char;
  DataSetIndex: byte;
  FullName: array[0..127] of Char;
  More: byte;
  Flags: byte;
begin
  RC := NWGetDefaultConnectionID(ConnectionID);
  ObjectType := 256; {user}
  StrPCopy(PropName, 'IDENTIFICATION');
  DataSetIndex := 1;
  StrPCopy(Name, SomeUser);
  RC := NWReadPropertyValue( ConnectionID,Name,ObjectType,PropName, DataSetIndex,FullName,More,Flags);
  if RC = 35324 then
    MessageDlg('No user ' + SomeUser + ' exists on this server!',
                mtError, [mbOK], 0);
  Result := StrPas(FullName);
end;

end.


hope it some help
Regards Barry
0
 
WiseGuyAuthor Commented:
Thanx Barry,

I am looking into this. If all goes well, you'll have your points before Christmas. Come to think of it: Best wishes and a succesfull 1900 (shoot, darn Y2k bug)
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
intheCommented:
:-) ok
0
 
WiseGuyAuthor Commented:
I didn't accept this answer.
0
 
lguiCommented:
Which answer you did not accepted?
0
 
intheCommented:
hi,
the auto-grader has been visiting again.
if it graded the question wrong then tell customer services should be able to help.
did you try the codes i put?
0
 
WiseGuyAuthor Commented:
Inthe,

I did try the codes you put. But I get a message stating the dll is corrupted and I need to reinstall.

I hate this autograder, I am entitled to my christmas holidays, right. :-)

CU
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now