PDA

View Full Version : FreeDLL: GetFolderLocations


RizlaUK
10-10-2007, 10:42 AM
ok, ok, i know what you all going to say.....use "Shell.GetFolder"

but heres the deal, shell.getfolder dose not get all the system folders, so heres a dll that dose,


heres a list of the number values for each folder in vista and xp
Vista
0 C:\Users\Username\Desktop\
2 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Start Menu\Programs\
5 C:\Users\Username\Documents\
6 C:\Users\Username\Favorites\
7 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Start Menu\Programs\Startup\
8 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Recent\
9 C:\Users\Username\AppData\Roaming\Microsoft\Window s\SendTo\
11 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Start Menu\
13 C:\Users\Username\Music\
14 C:\Users\Username\Videos\
16 C:\Users\Username\Desktop\
19 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Network Shortcuts\
20 C:\Windows\Fonts\
21 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Templates\
22 C:\ProgramData\Microsoft\Windows\Start Menu\
23 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
24 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
25 C:\Users\Public\Desktop\
26 C:\Users\Username\AppData\Roaming\
27 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Printer Shortcuts\
28 C:\Users\Username\AppData\Local\
29 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Start Menu\Programs\Startup\
30 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
31 C:\Users\Username\Favorites\
32 C:\Users\Username\AppData\Local\Microsoft\Windows\ Temporary Internet Files\
33 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Cookies\
34 C:\Users\Username\AppData\Local\Microsoft\Windows\ History\
35 C:\ProgramData\
36 C:\Windows\
37 C:\Windows\System32\
38 C:\Program Files\
39 C:\Users\Username\Pictures\
40 C:\Users\Username\
41 C:\Windows\System32\
42 C:\Program Files\
43 C:\Program Files\Common Files\
44 C:\Program Files\Common Files\
45 C:\ProgramData\Microsoft\Windows\Templates\
46 C:\Users\Public\Documents\
47 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\
48 C:\Users\Username\AppData\Roaming\Microsoft\Window s\Start Menu\Programs\Administrative Tools\
53 C:\Users\Public\Music\
54 C:\Users\Public\Pictures\
55 C:\Users\Public\Videos\
56 C:\Windows\Resources\
59 C:\Users\Username\AppData\Local\Microsoft\Windows\ Burn\Burn\



XP
0 C:\Documents And Settings\Username\Desktop\
2 C:\Documents And Settings\Username\start Menu\Programs\
5 C:\Documents And Settings\Username\My Documents\
6 C:\Documents And Settings\Username\Favorites\
7 C:\Documents And Settings\Username\start Menu\Programs\Startup\
8 C:\Documents And Settings\Username\Recent\
9 C:\Documents And Settings\Username\SendTo\
11 C:\Documents And Settings\Username\start Menu\
13 C:\Documents And Settings\Username\My Documents\My Music\
16 C:\Documents And Settings\Username\Desktop\
19 C:\Documents And Settings\Username\NetHood\
20 C:\WINDOWS\Fonts\
21 C:\Documents And Settings\Username\Templates\
22 C:\Documents And Settings\All Users\start Menu\
23 C:\Documents And Settings\All Users\start Menu\Programs\
24 C:\Documents And Settings\All Users\start Menu\Programs\Startup\
25 C:\Documents And Settings\All Users\Desktop\
26 C:\Documents And Settings\Username\Application Data\
27 C:\Documents And Settings\Username\PrintHood\
28 C:\Documents And Settings\Username\Local Settings\Application Data\
31 C:\Documents And Settings\All Users\Favorites\
32 C:\Documents And Settings\Username\Local Settings\Temporary Internet Files\
33 C:\Documents And Settings\Username\Cookies\
34 C:\Documents And Settings\Username\Local Settings\History\
35 C:\Documents And Settings\All Users\Application Data\
36 C:\WINDOWS\
37 C:\WINDOWS\system32\
38 C:\Program Files\
39 C:\Documents And Settings\Username\My Documents\My Pictures\
40 C:\Documents And Settings\Username\
41 C:\WINDOWS\system32\
43 C:\Program Files\Common Files\
45 C:\Documents And Settings\All Users\Templates\
46 C:\Documents And Settings\All Users\Documents\
47 C:\Documents And Settings\All Users\start Menu\Programs\Administrative Tools\
53 C:\Documents And Settings\All Users\Documents\My Music\
54 C:\Documents And Settings\All Users\Documents\My Pictures\
56 C:\WINDOWS\Resources\
59 C:\Documents And Settings\Username\Local Settings\Application Data\Microsoft\CD Burning\


Example:
result = DLL.CallFunction("AutoPlay\\Docs\\GetSpecialFolderLocation.dll", "GetSpecialFolderLocation", 59, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);

would return
XP: C:\Documents And Settings\Username\Local Settings\Application Data\Microsoft\CD Burning\
Vista: C:\Users\Username\AppData\Local\Microsoft\Windows\ Burn\Burn\

This dose work on 98 but i dont have it installed to get the exact codes (if someone with 98 installed could run the example, save the contents of the debug window and send it to me i will add the codes to the list)


Heres the apz

mz241508
10-10-2007, 11:41 AM
Thank you so much, just what i need! :yes :D

RizlaUK
10-10-2007, 11:48 AM
no problem MZ

Myst5
10-10-2007, 01:33 PM
Thank you very much
it's right what i needed
thanks again

vtivti
11-24-2007, 06:21 PM
Again - Thanks alot, just spent 2 hours trying to do this, then found this. Thank you VERY much

Solmos
08-05-2008, 02:08 PM
Hi

this is XP 64 bits and VISTA 64 bits compatible?

thx

RizlaUK
08-06-2008, 08:38 AM
dunno, i dont have a 64 bit system to try, try it and find out :yes

RizlaUK
08-06-2008, 08:56 AM
dose AMS even run on 64 bit systems?

ShadowUK
08-06-2008, 11:01 AM
dose AMS even run on 64 bit systems?

Yes, But runs as x86.

Solmos
08-06-2008, 02:12 PM
No, sorry, I express evil

(I do not know English)

Queria know if it detects routes 64-bit systems?

I'm not sure, but I think there are new variables in 64-bit systems.

Thank you, a greeting

RizlaUK
08-06-2008, 05:26 PM
that dll uses "SHGetSpecialFolderLocation" and "SHGetPathFromIDList" API which both appear to present on 64 bit so i would say yes, but it would still need testing

Solmos
08-09-2008, 02:48 AM
Hi

for example, this new variables:

%ProgramFilesFolder64%, %CommonFilesFolder64%, %System32(64)%, etc

thx

RizlaUK
08-09-2008, 06:21 AM
but im not useing session variables, im useing API

sol, i dont have 64 bit system so i cant test so im not doing anything to the dll

have you tested it on 64 bit system yet ??

Protocol
10-15-2008, 12:44 AM
I've been running into folder access problems with a major client. Basicly, my app runs another exe in the user's temp folder. But in random cases, it fails to launch the app without warning. Now through all of the troubleshooting, I've narrowed it down to a permissions issue. My question is this...

1) I'm thinking about getting a certificate to eliminate any question from the OS (knowing that this won't neccessarily fix anything other than an annoying unknown author popup on Vista). But since the exe I'm launching is background, might this fix the strange no-execuation situation?

2) I'm thinking of moving the temp folder from _TempFolder to their all-users shared documents folder. I'm thinking that this might allow me to have more movement without setting off any flags (for this client, I need as little user interaction as possible). Do you think that moving the folder will make a difference?

3) Should I be using the all-users shared documents folder as a temp folder or is this against protocol? I other words, if this would be considered a breach of some standardized coding rule or ethic, then which fodler could I use universally across most OS's that would grant me behind the scenes manuverability?



I'm using your GetFolderLocations (specifically folder #46 - the all users documents folder). Is it okay to use and temporarily store info here or am I going to get pummelted by the online community for some shameful act?

Its really a Windows directory protocol question. Help with the other facets of this question is greatly appreciated as well!

Thanks, crew!

qwerty
11-01-2008, 04:51 PM
hi buddy :)

i find myself in need of the ability to inject a file into the users "Quick Launch" folder.

initially, this needs to be a shortcut, and for the current user only.

eventually, i need to expand this to all users, and inject possibly a .scf file.

i know from testing, the quick launch folder is profile specific, and does not have an "all users" equivalent running parallel, like the destop does.

is it possible to use your DLL to return initially the current users QuickLaunch folder, and then later use it to return ALL of them on the system ?


ps, just to be awkward, i need this to be compatible on ALL versions of windows, from 98 through to vista 64bit.

all help appreciated :)


one, last question, aimed at anyone and everyone.... from a user account with admin rights, can i write to the quick launch folders for all users, or am i going to run into a permissions issue ?

RizlaUK
11-01-2008, 05:30 PM
ok, you wont need the dll to do that, the quick launch is set at the same path on every system, the only variable factor is the username, so its a case of getting all the users on the pc and build the path that way

-- get user
sUser = System.GetLANInfo().User;
-- get os
sOS = System.GetOSName();
-- get windows drive
sDrive = String.SplitPath(_WindowsFolder).Drive;

if sOS == "Windows XP" then
-- for vista
sQuickLaunch=sDrive.."\\Users\\"..sUser.."\\AppData\\Roaming\\Microsoft\\Internet Explorer\\Quick Launch"
else
-- for xp,2k,98,95
sQuickLaunch=sDrive.."\\Documents and Settings\\"..sUser.."\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch"
end

-- Test
Dialog.Message("Notice", sQuickLaunch);

the above code is good for getting the QL folder on a per user basis, now you just need to get all the users on the system and repeat the process, not sure how its done right now, i'll look into it

qwerty
11-01-2008, 07:35 PM
ok, i was compiling a reply, showing what i thought would work for current user...

QL_Location = (Shell.GetFolder(SHF_APPLICATIONDATA).. "\\Microsoft\\Internet Explorer\\Quick Launch");

when i realised ive got a bug in my theory.... the "roaming" folder on vista will trip me up... damit.

thanks for the example above, looks like i had some duff gen on the true file path for vista.

back to the drawing board !

RizlaUK
11-01-2008, 07:46 PM
hummm, i dont understand, the code you posted should work,

SHF_APPLICATIONDATA on vista returns "C:\Users\User\AppData\Roaming" and "C:\Documents and Settings\User\Application Data" on xp, so in both cases it points to the correct folder

your code is better than mine :p

qwerty
11-01-2008, 07:52 PM
errrr....:huh

if sOS == "Windows XP" then
-- for vista


i'm gettting the feeling that should be
if sOS ~= "Windows XP" then

qwerty
11-01-2008, 07:56 PM
hummm, i dont understand, the code you posted should work,

SHF_APPLICATIONDATA on vista returns "C:\Users\User\AppData\Roaming" and "C:\Documents and Settings\User\Application Data" on xp, so in both cases it points to the correct folder

your code is better than mine :p


ahhhh ... i was under the impression the SHF_APPLICATIONDATA would return upto and including the AppData folder on vista, but stop short of the Roaming folder, thus cause me a problem...... but i dont have (and dont want) a vista system ! ... so i will trust your result there and say thank you for testing it for me :D

ok, just the All Users option to look at now then, time to hit the search function and see what i can find on returning a table or list of the users

RizlaUK
11-01-2008, 08:37 PM
if sOS == "Windows XP" then

DoH!, i really should check demo code, lol

heres a C++/.Net example useing WMI
http://www.codeproject.com/KB/system/EnumerateLocalUser.aspx

but i cant find anything i can use in AMS yet.

qwerty
11-01-2008, 08:50 PM
yeah it's getting late here and the all user thing is giving me a headache, when i start thinking about the variables involved, for example the options i need to give in the dialog box of "include quick launch item" ... "apply to all users or current only" ..... then i have to remember pre Win2000 doesnt have the multi account options, so i need to make sure i dont try applying that section of the code, it might be easier to stick to single user account for now, and deal with the other aspect of what i need the quick launch item to do... and come back to the all users option later, thx for the help :yes


anyway, time for sleep i think :)

shinway
11-02-2008, 01:11 AM
OK so I'm trying to get a folder to install at

26 C:\Users\Username\AppData\Roaming\
26 C:\Documents And Settings\Username\Application Data\

for vista and xp


what is the steps to doing this, what screen do you enter this into,


does this get entered into session variables, or folder reference properties, or is it added in under actions, hmm not sure of this method, I'm very new to setup factory and would really like to understand how to make my folder install under those directories.

qwerty
11-02-2008, 02:38 AM
:huh Setup Factory ?

no idea, this thread is in the AutoPlay Media Studio section, i have no idea on Setup Factory scripting, but i'm sure someone will be able to help

shinway
11-02-2008, 03:10 AM
hmm think Ive figured it out, was actually very simple and just used Session Variables lool and yea used the search function and didn't noticed it wasn't setup factory... sorry

qwerty
11-02-2008, 03:33 AM
hmm think Ive figured it out, was actually very simple and just used Session Variables lool and yea used the search function and didn't noticed it wasn't setup factory... sorry

LOL, i just did the same thing this morning in a Setup Fctory thread, must have searched from the wrong little box :p

glad your sorted, now if only i could do it from AMS :lol

qwerty
11-02-2008, 05:11 AM
ok, so....

from a cmd window, "net user" will return a list of all accounts registered to that PC.

now i', wondering if it's possible to export that list to a text file, and utilise it some how. However, i have discovered another possible hurdle, if a user account is passworded, then i dont think i will be able to inject into the quick launch folder.

i did find a way to add it into the "Default User" account, but this will only add my required item at account creation stage and not post creation ... damit !

this is getting awkward LOL... i'm sure windows does it somehow with the internet explorer link, as this can be added on the fly like i am trying to do!

rexzooly
10-07-2009, 10:40 AM
is there a link to this dll anymore?

qwerty
10-07-2009, 11:02 AM
yeah someone reposted it in this thread as an example

http://www.indigorose.com/forums/showthread.php?t=27353

as far as i know that is the same one


BTW.... i've also had an app using it tested it on a Vista 64 bit machine and for me getting the cookies folder (33) worked fine