BLUF: I need to build up the actual %TEMP% path for all users
methodically using values in the registry, and I need to do this both
by the current user AND as a service will do this running as "Local
System." Thus, I can't rely on it always being ...\<Username>\ Local
Settings\Temp.
So, this partially applies to C#, because I'll need to do this in C#
code. But, I think I already know how to do it. What I don't know is
where to find the information in the registry.
I have a service running as Local System, and I need to find each
user's %TEMP% directory. I've found a location in the registry that
is helpful, but not exactly what I am looking for. So, any help is
greatly appreciated.
I need this information, because I need the service to write something
to a particular user's directory, and as evidenced by MSFT's Virtual
PC Images, this is not always how a machine in set up (the user is
`IETester` but the %TEMP% dir is `C:\DOCUME~1\IE Test\Local Settings
\Temp" (notice `IETest` instead of `IETester`).
The locations that I found in the registry are:
HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Explorer
\Shell Folders
HKEY_USERS\S-1-...\Software\Mi crosoft\Windows \CurrentVersion \Explorer
\Shell Folders
HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\Windows \CurrentVersion \Explorer
\DocFolderPaths
Obviously, the CURRENT_USER is useless, because the service (running
as Local System) won't know the current user (and I need all users
anyway). If I use the value in USERS, I'll have to backtrace and find
the value of %USERPROFILE% somewhere. The LOCAL_MACHINE looks like a
reasonable place, but I don't know if it is exactly what I'm looking
for. Another problem with LOCAL_MACHINE (at least, with the registry
key I'm referencing above), is that the "Value" listed is still not
the user name for the current user. (Ex: Value is `IETest` and the
value's data is set to `C:\Documents and Settings\IETest \My
Documents`. However, the actual USER NAME is `IETester`.
Sidenote: System.IO.GetTe mpPath() returns the value "C:\Documen ts and
Settings\IETest \Local Settings\Temp," so that at least jives with what
I'm seeing in the registry (instead of relying on the actual username
to hardcode paths), but I still can't put everything together.
What is the best way to do this? I'm not sure which values in the
registry get changed if the user changes the default setting/location,
so I don't know exactly where to look. And one last question: Is this
location/forumlation the same between XP and Vista (ignoring the
Wow6432Node)?
Any help/insite is greatly appreciated! 3 1638
On Mon, 16 Jun 2008 20:55:46 -0700, thephatp <ch***********@ gmail.com>
wrote:
[...]
Obviously, the CURRENT_USER is useless, because the service (running
as Local System) won't know the current user (and I need all users
anyway). If I use the value in USERS, I'll have to backtrace and find
the value of %USERPROFILE% somewhere.
Well, for better or worse, that's what you have to do. The "HKEY_USERS "
sub-keys are the ones that are per-user. If you want per-user
information, you need to inspect that part of the registry.
Pete
On Jun 17, 12:44*am, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Mon, 16 Jun 2008 20:55:46 -0700, thephatp <chad.a.mor...@ gmail.com*
wrote:
[...]
Obviously, the CURRENT_USER is useless, because the service (running
as Local System) won't know the current user (and I need all users
anyway). *If I use the value in USERS, I'll have to backtrace and find
the value of %USERPROFILE% somewhere.
Well, for better or worse, that's what you have to do. *The "HKEY_USERS "*
sub-keys are the ones that are per-user. *If you want per-user *
information, you need to inspect that part of the registry.
Pete
I was hoping that wouldn't be the answer. D'oh. So, if I have to do
that, where can I find the value of %USERPROFILE%?
Thanks!
On Tue, 17 Jun 2008 05:29:58 -0700, thephatp <ch***********@ gmail.com>
wrote:
I was hoping that wouldn't be the answer. D'oh. So, if I have to do
that, where can I find the value of %USERPROFILE%?
I don't recall the details. You should find a newsgroup more specific to
unmanaged Windows API programming. However, I do have a vague memory that
there's a section in the HKEY_USER section for the user themselves that
contains the value for that variable.
You may find the easiest thing is to just create a brand new user, and
snoop around in the registry for that user to see what you find. Even a
brand new user will have lots of stuff in there, but at least that should
help minimize the extraneous stuff.
Pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Geo |
last post by:
Hi to all,
How can I create a registry key that can be deleted by
any user on the machine.
A sample code or any other reference will be greatly
appreciated.
Thanks,
Geo
|
by: lester |
last post by:
a pre-beginner's question:
what is the pros and cons of .net, compared to ++
I am wondering what can I get if I continue to learn C# after I have learned
C --> C++ --> C# ??
I think there must be many know the answer here.
thanks
|
by: Steven |
last post by:
I just downloaded the June 2005 release and I want to set up basic logging to
log problems such as exceptions.
I have created a category named Exceptions with the following:
<category name="Exceptions">
<destinations>
<destination name="Event Log Destination" sink="Event Log Sink"
format="Text Formatter" />
</destinations>
</category>
|
by: Abby |
last post by:
I'm sorry that I post this question in this newsgroup, but I don't
know where is the right place to post. I have a question if I can get
to CPU's registry to modify its clock cycle so that I can save some
power when CPU is idle (throttling). I need to do it in C, and the
program need to be runnable in Linux. Anybody know the way, plz let me...
|
by: Scott Schluer |
last post by:
Hello,
I'm fairly experience with VB.NET in so far as it's syntax is concerned,
however I'm coming from a web-based environment. Typically, when I want to
store data (i.e. user preferences, options, etc), I'll use SQL Server or
Access or something. I'm just making my way into Windows development and I'm
trying to recreate an e-mail checker...
| |
by: Alan |
last post by:
dear all,
I saw a program using VB.NET can auto-startup/ execute after logon the
Windows. However, the program is not run as the startup menu?
what function can vb.net detect the logon progressing so as to auto-run?
Thanks
|
by: Jeremy S. |
last post by:
..NET's code Access Security enables administrators to restrict the types of
things that a .NET application can do on a local computer. For example, a
..NET Windows Forms application can be prevented from writing to the Registry
or writing a file to the local disk.
My question: Is this feature unique to .NET? Or is it just as easy for...
|
by: Roy |
last post by:
Does anybody have any idea why 2 identical classic asp pages, hitting the
same Oracle schema, but deployed on 2 different servers will render the
registered trade mark differently?
Example:
PROTONIX®
get displayed when calling the page deployed on server A, while
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |