News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Registering file extensions

Started by donkey, December 03, 2008, 10:17:57 PM

Previous topic - Next topic

donkey

Not sure if anyone else has had this problem but it has been annoying me ever since I built this machine a few months ago. I have Windows XP Home installed and when I right click a RAP file and browse to RadASM to open it I am completely ignored. Windows does not use RadASM to open it and RadASM doesn't appear on the list of programs. Alsoa dding the type to "Tools..Folder Options.File Types" doesn't work as it wont let me select RadASM either. So in order to have RAP files open properly with a double click I registered the file type with Windows...

invoke RegisterFileExtension,"rap","Open",'C:\Programming\RadASM\RadASM.EXE "%1"'
invoke ExitProcess,0

RegisterFileExtension FRAME pFileExt,pCmd,pCmdLine
LOCAL hClassKey :D
LOCAL hCmdKey :D
LOCAL Disposition :D
LOCAL szExt[16] :B
LOCAL szCmd[260] :B

; Be sure the extension starts with .
mov eax,[pFileExt]
mov al,[eax]
cmp al,2EH
je >
lea eax,szExt
mov B[eax],2EH
inc eax
jmp >C1
:
lea eax,szExt
C1:
invoke lstrcpy,eax,[pFileExt]

invoke RegCreateKeyEx, HKEY_CLASSES_ROOT, offset szExt, 0, 0, \
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, \
ADDR hClassKey, ADDR Disposition

invoke wsprintf,offset szCmd,offset CmdFmt,[pCmd]
add esp,12

invoke RegCreateKeyEx, [hClassKey], offset szCmd, 0, 0, \
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, \
ADDR hCmdKey,ADDR Disposition
invoke lstrlen,[pCmdLine]
inc eax
invoke RegSetValueEx,[hCmdKey], NULL, 0, REG_SZ, [pCmdLine], eax
invoke RegCloseKey,[hCmdKey]
invoke RegCloseKey,[hClassKey]

xor eax,eax
RET
CmdFmt: DB "Shell\%s\Command",0
ENDF
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Mark Jones

Great example Donkey, but this and your problems with k-meleon seem rather unique. Are you using a limited user account or aggressive firewall or something?
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

donkey

Quote from: Mark Jones on December 04, 2008, 12:02:52 AM
Great example Donkey, but this and your problems with k-meleon seem rather unique. Are you using a limited user account or aggressive firewall or something?

Except when I am writing software or doing system maintenance I am always using a limited account. But I have the same problem when logged on as administrator so it is something other than privilege level that is causing it. I have to admit that since this is my dev pc there could be any number of projects that I have on the go that could have caused this and I am searching through my code right now. As for k-meleon, the problems with it are inherent to the browser and known bugs - the most annoying of which is that I have to type the URLs for all exceptions to such things a s cookie usage, in some secure sites such as my bank this might involve 4 or 5 URLs and even then I still have problems, though I do like the package I have almost completed my reversion to Firefox.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable