Code:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\DefaultUserName
You can read the currently logged on user's username from that registry entry. In the
Code:
C:\Documents and Settings\username\Application Data\Mozilla\Firefox
folder, you'll find the Profiles.ini file. Read it into your programs memory. They always start more or less like this:
Code:
[General]
StartWithLastProfile=1
[Profile0]
Name=default
IsRelative=1
Path=Profiles/qioxtndq.default
Just read by line until you get the "Name=default" line, read the next line, if it says "IsRelative=1" then read the next line and strip the leftmost 5 characters, and add it to the end of the Firefox folder, if it says "IsRelative=0" (less likely), just read the next line, strip the leftmost 5, and you have the default profile folder.