Sorry for crossposting, I need solution urgently. In my application
(service) I have to build a list of all free drive letters, exactly as
logged in user sees them. I do know that network mapped drives are
local to login session. I do know login/password of logged in user. I
can not just write another application (not service) that will supply
this information to my main service via some kind of IPC.
As I understand I need to find a session of my user
(LsaEnumerateLogonSessions and LsaGetLogonSessionData), get LogonId
and .. ??
Thanks.
Michael.
--
"Michael Sternberg" <mis...@sdf.lonestar.org> wrote in message
news:fd8eb3f4.04071...@posting.google.com...
> Hello
>
> Sorry for crossposting, I need solution urgently. In my application
> (service) I have to build a list of all free drive letters, exactly as
> logged in user sees them. I do know that network mapped drives are
> local to login session.
Not exactly , that like this in XP/WinServer 2003 , but not before , look at
http://support.microsoft.com/?kbid=180362 and restrictions of services to
access drives.
Arkady
Well, I'm working in XP/2003 (as the subject says). And according to this
KB article "On Windows XP and on Microsoft Windows Server 2003, each logon
session receives its own set of drive letters..". I'm aware of restriction
that "service cannot access the drive letters that are established in a
different logon session".
Still, I'm looking for way to do it. I have all needed privelegies, I have
login and password of user and I do want to know his/her driver mappings..
Arkady
"Michael Sternberg" <mis...@sdf.lonestar.org> wrote in message
news:fd8eb3f4.04071...@posting.google.com...
Load user's registry hive and look under the Network key
--
Eugene
Not good. You're talking about Win2K. There is no Network key in HKCU in XP.
I've checked with Registry Monitor for all settings in registry that written
when I perform drive mappings. For example I mapped \\server\install to be my
W: on WinXP:
All settings were written to
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2
There is no W: there and also not in whole registry apart from
HKLM\SYSTEM\MountedDevices
I do not think that data about current user network drive mappings is
stored in registry in WinXP and higher, there is should be some API to
retrive it.
Oops, sorry for previous message. If I check "Reconnect on logon" when
perform mapping - setting appears in Network in HKCU even on Windows XP.
Now - the problem is when I do not check it. Mapping does not appears even
in Windows 2000 and I do have to know all free volume letters for this user.
On Windows 2000 hovewer calling GetLogicalDrives() from service returns that
letter of mapped volume is busy, just like it should be.
Summary: when running as service on WinXP I want to know free volume
letters of given user even if he mapped network share and did not checked
"Reconnect on logon" checkbox.
Thanks.
> Summary: when running as service on WinXP I want to know free volume
> letters of given user even if he mapped network share and did not
> checked "Reconnect on logon" checkbox.
Grab WinObj from Sysinternals and take a look under Sessions\<session
id>\DosDevices\
Also check this
You will need to use native API to work with this stuff. Shouldn't be too
hard but ask here or on
microsoft.public.win32.programmer.kernel if you are in trouble.
--
Eugene
Thanks a lot. Now can you just push me into the right direction and
tell
me what API to look for in MSDN ? Unfortunately there is no sources of
WinObj.exe :(
Native API is an interesting beast. Small parts of it are documented in the
DDK section of MSDN in a very lousy way. Mostly it is left undocumented by
MS (the way things go they will soon stop documenting Win32 too) but there
are numerous sources on the Web and in print that fill this gap. Check
http://undocumented.ntinternals.net/ntundoc.chm and let your employer buy
"Windows NT/2000 Native API Reference" which is worth every buck.
Regarding the API you need start researchning ZwQueryDirectoryObject or
NtQueryDirectoryObject.
--
Eugene
Thanks everybody. Few calls to NtOpenDirectoryObject/NtQueryDirectoryObject
solved the whole problem. I wonder why this API is hidden and undocumented..
That's because it's native API and all ( almost ) set of them not documented
in MSDN , but do documented in Garry Nebbett's book ( Eugene mentioned ) on
page 74... :).
Arkady