rudi Posted April 3, 2008 Share Posted April 3, 2008 (edited) Hi all.Does anybody know how to retrieve the Novell eDirectory Username from the Novell Client for Netware?The environment variable "NWUSERNAME" is only set, IF the eDir Login was done through the inital login (NWGINA), later on logins don't make it to that "NWUSERNAME", and if the users don't run login scripts there is also no chance to set this variable through the login script.For NW3.x and NW4.x there was a DOS Program "WHOAMI.EXE", it's output looks like this:Z:\!411\PUBLIC>whoami Aktueller Baum: TREENAME Beschreibung: admin@domain.de Benutzer-ID: Admin Server: FS1 NetWare 5.70.06 Verbindung: 246 (Verzeichnis-Services) Benutzer-ID: Admin Server: BM NetWare 5.70.06 Verbindung: 140 (Verzeichnis-Services) Benutzer-ID: Admin Server: BM1 NetWare 5.70.06 Verbindung: 11 (Verzeichnis-Services)Any suggestions how I can try to retrieve this "CN" info from Novell Client for Netware, Vers. 4.91.4 appreciated (some DLL call or whatever).Thanks, Rudi.Edit: Typo corrected. Edited April 13, 2008 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
rudi Posted April 9, 2008 Author Share Posted April 9, 2008 bump. Who might help just with an idea how to dig what DLL of the NWClient 4.91.x might offer an option to "ask" for that information? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
DaveF Posted April 10, 2008 Share Posted April 10, 2008 Here's what I was able to come up with, it returns the name of the NetWare logged-in user. This took a while because there were undated, conflicting examples on the Web for the usage and the function prototypes. I have client 4.91.3 on my own PC. Please clean up and add proper function result tests before using in production code. expandcollapse popupDim $ourHandle, $ourResult, $ourID, $ourNumber Dim $ourUserName, $ourObjectType, $ourObjectID, $ourLoginTime ; This is a deliberately terse proof-of-concept example ; One should ALWAYS test @error and element [0] of the return of DllCall ; and make provisions to close the DLL handle on failure. ; Open NetWare utility DLL $calwin32Dll = DllOpen(@SystemDir & "\calwin32.dll") ; Initialize $ourResult = DllCall($calwin32Dll, "int", "NWCallsInit", "int", 0, "int", 0) ; Create 1-element structures we'll use $ourHandle = DllStructCreate("uint") DllStructSetData($ourHandle, 1, 0) $ourNumber = DllStructCreate("uint") DllStructSetData($ourNumber, 1, 0) $ourObjectType = DllStructCreate("udword") DllStructSetData($ourObjectType, 1, 0) $ourObjectID = DllStructCreate("udword") DllStructSetData($ourObjectID, 1, 0) $ourLoginTime = DllStructCreate("byte") DllStructSetData($ourLoginTime, 1, 0) ; Get connection ID $ourResult = DllCall($calwin32Dll, "int", "NWGetPrimaryConnectionID", "ptr", DllStructGetPtr($ourHandle, 1)) ; Get our connection number $ourResult = DllCall($calwin32Dll, "int", "NWGetConnectionNumber", "uint", DllStructGetData($ourHandle, 1), "ptr", DllStructGetPtr($ourNumber, 1)) ; Get info for our connectiuon $ourResult = DllCall($calwin32Dll, "int", "NWGetConnectionInformation", "uint", DllStructGetData($ourHandle, 1), "uint", DllStructGetData($ourNumber, 1), "str", $ourUserName, "ptr", DllStructGetPtr($ourObjectType, 1), "ptr", DllStructGetPtr($ourObjectID, 1), "ptr", DllStructGetPtr($ourLoginTime, 1)) ; Show result MsgBox(0, "Debug", "NetWare username shows as: " & $ourResult[3]) ; Cleanup DllClose($calwin32Dll) Hope this helps. Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
rudi Posted April 11, 2008 Author Share Posted April 11, 2008 Hi Dave.Here's what I was able to come up with, it returns the name of the NetWare logged-in user. This took a while because there were undated, conflicting examples on the Web for the usage and the function prototypes.Thanks a lot for your code.What did you search for to find some examples in the web? I tried as well to find something, but obviously I used inproper search strings.What examples did you find? Some URLs might help me for future searches in similar cases... I'll test your code next Monday Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
rudi Posted April 11, 2008 Author Share Posted April 11, 2008 I had to test it immediately It's working fine for NWClient even on Win98SE. Tested so far: - 4.91.4: XP, Win2k3, Win2k3 Terminal Server sessions - 3.40: Win98SE Thanks again, Rudi. PS: What's the right approach to find out what other information can be accessed through CALWIN32.DLL? Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
DaveF Posted April 11, 2008 Share Posted April 11, 2008 Thanks a lot for your code.Of course you're welcome, hope it's helpful. What did you search for to find some examples in the web? I tried as well to find something, but obviously I used inproper search strings.What examples did you find? Some URLs might help me for future searches in similar cases... I think I started with a Google search for 'get netware user name dll' and that turned up this page: http://www.compguy.com/cwtip01.htm, which though it was last updated 11 years ago was actually a good resource. I initially disregarded it because of its age and because it refers to NWCalls.DLL, which I knew wasn't the right name for the current NetWare utility DLL. By then searching Google for the names of the functions used on that page I was able to find more current examples. I reminded myself of the name of the current utility DLL by browsing through a NetWare client install source folder and looking at the DLLs there, but I think I originally learned which one to use from reading the API documentation at Novell, and I verified that I was correct by browsing the functions the DLL exported using FileAlyzer. Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
rudi Posted April 12, 2008 Author Share Posted April 12, 2008 Of course you're welcome, hope it's helpful.It is!1.) API documentation at Novell2.) ... browsing the functions the DLL exported using FileAlyzer.I'll immediatley jump to those two URLs.Thanks again, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now