does XP useually(?) have a scratch disk?
if so is 'Program Files' generally on f:\ or could it be e:\ ???
what should I expect?
thanx DC
What do you mean? Are you talking about temp folders?
"Program Files" is always on the partition containing the OS, but it is meaningless - you can install your programs anywhere you like.
There usually is a TEMP directory (per user) that you can see by typing SET at a cmd prompt.
TEMP=directory path which may be
DriveLetter:\Documents and Settings\Username\LOCALS~1\Temp
Also there may be a TEMP directory off of the WIN directory.
The 'Program Files' folder is always on the boot drive. The only time a partial image of it is stored on something that might be called a 'scratch disk' is if hibernation is turned on. This 'thing' is really a file but is not assigned a drive letter. It is treated more like a 'volume' if you know what they are but unlike Novell, Windows (not just XP) does not allow it to be mapped and it is destroyed at wakeup. Examining it would probably be fruitless because you will not see anything meaningful as it is a compressed volume.
hth,
Paul
cool,
so if I'm gettin this rite... a typical xp 'Project Files' is at 'c:\'
what I'm trying to do is make an install app for someone who doesn't know how to find their way around in the drives on xp...
I have plugins that can go in any number of plugin folders...
generally they would be in 'Program Files\SomethingOrOther\Plugins'
thanx guys,
DC
Why don't you use one of the many installer packaging apps already out there? Most of them will have the ability to easily specify that stuff gets dumped into Prog Files. And you shouldn't make the assumption that Prog Files is always on the C: drive - c drive is just the default install location for windows, many people install it somewhere different.
The "Program Files" directory could potentially be anywhere - though it's usually on C:\ by default, and most people don't move it.
However, just to be safe, get the location from the registry:
HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir"
And use the "GetTempPath" function to get the location of the temp folder :wink
Tedd I love you...
Thanx,
DC
You can also use one of the shell functions such as SHGetFolderLocation function. Pass CSIDL_PROGRAM_FILES for the nFolder parameter.
best regards,
czDrillard
.386
.model flat, stdcall
option casemap:none
include WINDOWS.INC
include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib
include shell32.inc
includelib shell32.lib
include advapi32.inc
includelib advapi32.lib
include Comdlg32.inc
includelib Comdlg32.lib
.data
szTitle db "DC Filters Setup",0
szKeyName db "SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir",0
szErrGCD db "GetCurentDir Failed",0
szErrRQVE db "RegQueryValueEx Failed",0
dwType dw 0
dwLnth dw 0
BufFrom db 1000 dup (0)
BufTo db 1000 dup (0)
CurDir db 1000 dup (0)
.data?
hInstance dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCurrentDirectory, 1000, addr CurDir
.if !eax
invoke MessageBoxEx, NULL, addr szErrGCD , addr szTitle, MB_YESNO or MB_DEFBUTTON1 or MB_ICONQUESTION, LANG_ENGLISH
.endif
invoke RegQueryValueEx, HKEY_LOCAL_MACHINE, addr szKeyName, NULL, addr dwType, addr BufTo, addr dwLnth
.if eax == ERROR_SUCCESS
invoke MessageBoxEx, NULL, addr BufTo , addr szTitle, MB_YESNO or MB_DEFBUTTON1 or MB_ICONQUESTION, LANG_ENGLISH
.else
invoke MessageBoxEx, NULL, addr szErrRQVE , addr szTitle, MB_YESNO or MB_DEFBUTTON1 or MB_ICONQUESTION, LANG_ENGLISH
.endif
invoke ExitProcess, NULL
end start
I'm having no luck with the line:
invoke RegQueryValueEx, HKEY_LOCAL_MACHINE, addr szKeyName, NULL, addr dwType, addr BufTo, addr dwLnth
what's my folly?
thanx,
DC
Use RegOpenKeyEx and RegCloseKey before and after RegQueryValueEx
The key to open is SOFTWARE\Microsoft\Windows\CurrentVersion
The value to query is ProgramFilesDir
Regards,
Darrel
The alternative to poking at the resgistry is SHGetFolderLocation (as mentioned by czDrillard) - though it's not simply one function call..
And I don't think CSIDL_PROGRAM_FILES is valid on ealier versions of windows (since it was always in the same place anyway?)
.386
.model flat, stdcall
option casemap:none
include windows.inc
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
include shell32.inc
includelib shell32.lib
include ole32.inc
includelib ole32.lib
;**********************************************************************************************************
CSIDL_PROGRAM_FILES equ 26h ;only valid on later window versions!!
;**********************************************************************************************************
.data
progfiles db "Program Files",0
.data?
pidl DWORD ? ;receives the pointer to the idlist
buff db 320 dup (?) ;buffer to put our path string
.code
start:
;* get the shell-idlist for our given 'special' folder
invoke SHGetSpecialFolderLocation, NULL,CSIDL_PROGRAM_FILES,ADDR pidl
;* get the path from the idlist
invoke SHGetPathFromIDList, pidl,ADDR buff
;* display it
invoke MessageBox, NULL,ADDR buff,ADDR progfiles,MB_OK
;* we must cleanup the memory reserved for the idlist, once we've finished with it
invoke CoTaskMemFree, pidl
invoke ExitProcess, NULL
end start
Thanx Darrel,
I guess I didn't look closely at the remarks for that, I useually do, oh well thanx again.
thanx too and again Tedd,
but for SHGetFolderLocation it says "Minimum operating systems Windows 2000, Windows Millennium Edition" so that wont work as I want to reuse this utility on 95 up.
thanx all,
DC
still not gettin' something...
.386
.model flat, stdcall
option casemap:none
include WINDOWS.INC
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
include shell32.inc
includelib shell32.lib
include advapi32.inc
includelib advapi32.lib
include Comdlg32.inc
includelib Comdlg32.lib
.data
szTitle db "DC Filters Setup",0
szKeyName db "ProgramFilesDir",0
szSubKey db "SOFTWARE\\Microsoft\\Windows\\CurrentVersion",0
szErrRQVE db "RegQueryValueEx Failed",0
szErrROK db "RegOpenKeyEx Failed",0
dwType dw 0
dwLnth dw 1000
BufTo db 1000 dup (0)
CurDir db 1000 dup (0)
.data?
hInstance dd ?
hKey dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
;======================================================================================================
invoke RegOpenKeyEx, HKEY_LOCAL_MACHINE, szSubKey, 0, KEY_QUERY_VALUE, addr hKey
;======================================================================================================
.if eax == ERROR_SUCCESS
invoke RegQueryValueEx, hKey, addr szKeyName, NULL, addr dwType, addr BufTo, addr dwLnth
.if eax == ERROR_SUCCESS
invoke MessageBoxEx, NULL, addr BufTo , addr szTitle, MB_OK or MB_ICONERROR, LANG_ENGLISH
.else
invoke MessageBoxEx, NULL, addr szErrRQVE , addr szTitle, MB_OK or MB_ICONERROR, LANG_ENGLISH
.endif
invoke RegCloseKey,addr hKey
.else
invoke MessageBoxEx, NULL, addr szErrROK , addr szTitle, MB_OK or MB_ICONERROR, LANG_ENGLISH
.endif
invoke ExitProcess, NULL
end start
[edit] I've tried it with single"\" too [edit]
this doesn't get hKey??
any clues?
thanx,
DC
latest try still not there:
.386
.model flat, stdcall
option casemap:none
include WINDOWS.INC
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
include shell32.inc
includelib shell32.lib
include advapi32.inc
includelib advapi32.lib
include Comdlg32.inc
includelib Comdlg32.lib
.data
szTitle db "DC Filters Setup",0
szKeyName db "ProgramFilesDir",0
szSubKey db "SOFTWARE\Microsoft\Windows\CurrentVersion",0
szErrRQVE db "RegQueryValueEx Failed",0
szErrROK db "RegOpenKeyEx Failed",0
dwType dw 0
dwLnth dw 1000
BufTo db 1000 dup (0)
CurDir db 1000 dup (0)
.data?
hInstance dd ?
hKey dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke RegOpenKeyEx, HKEY_LOCAL_MACHINE, addr szSubKey, 0, KEY_QUERY_VALUE, addr hKey
.if eax == ERROR_SUCCESS
invoke RegQueryValueEx, addr hKey, addr szKeyName, NULL, addr dwType, addr BufTo, addr dwLnth
.if eax == ERROR_SUCCESS
invoke MessageBoxEx, NULL, addr BufTo , addr szTitle, MB_OK or MB_ICONERROR, LANG_ENGLISH
.else
invoke MessageBoxEx, NULL, addr szErrRQVE , addr szTitle, MB_OK or MB_ICONERROR, LANG_ENGLISH
.endif
invoke RegCloseKey, addr hKey
.else
invoke MessageBoxEx, NULL, addr szErrROK , addr szTitle, MB_OK or MB_ICONERROR, LANG_ENGLISH
.endif
invoke ExitProcess, NULL
end start
HELP!!!!
make these modifications to your last post.
.data?
BufTo db 1000 dup (?)
invoke RegQueryValueEx, hKey, addr szKeyName, NULL, addr dwType, addr BufTo, addr dwLnth
I guess I was misled by the name of your post xp drives Q made me think this is an xp os question. Use SHGetSpecialFolderLocation for shell32.dll version 4.7 if your using windows 9x and of course there is more than one parameter to pass. The one I mentioned is the key one if you're looking for Program Files folder. :)
best regards,
czDrillard
how rusty can I be?
thanx Darrel... it works now.
I'll be back