How can get a local windows service to detect who is logged in to Netware
Client on a workstation?

This code (Delphi) works as an application, but not as a service:

if NWCallsInit(nil, nil) = 0 then
if NWIsDSAuthenticated <> 0 then
if NWDSCreateContextHandle(NovellContextHandle) = 0 then
if NWDSWhoAmI(NovellContextHandle, @NovellBuffer) = 0 then
NovellUserName := UpperCase(StrPas(@NovellBuffer));

Any help would be appreciated.