Creating a User Protocol (Windows 7)

I am trying to create my own protocol (open_php_file: //) to open local files through a browser. I created the following registration keys:

HKEY_CLASSES_ROOT open_php_file (Default) = "URL:PHPEd protocol" URL Protocol = "" DefaultIcon (Default) = "phped.exe" shell open command (Default) = "C:\Program Files (x86)\NuSphere\7.0\phped.exe" "%1" 

The problem is that I cannot open files in my browser (example: open_php_file: // c: \ file.txt), and the protocol is not specified in the default Windows programs.

+7
source share
2 answers
 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\openphpfile] @="\"URL:openphpfile Protocol\"" "EditFlags"=hex:02,00,00,00 "URL Protocol"="" [HKEY_CLASSES_ROOT\openphpfile\DefaultIcon] @="\"C:\\Users\\ABC\\Documents\\Programs\\CB\\Chunks\\CGI.exe\",0" [HKEY_CLASSES_ROOT\openphpfile\shell] [HKEY_CLASSES_ROOT\openphpfile\shell\open] [HKEY_CLASSES_ROOT\openphpfile\shell\open\command] @="\"C:\\Users\\ABC\\Documents\\Programs\\CB\\Chunks\\CGI.exe\" -c \"%1\"" 

The main problem was underscores in your protocol. After the removal, everything started to work fine. You can change the path of the executable file according to your desire, that is, "C: \ Program Files (x86) \ NuSphere \ 7.0 \ phped.exe".

I tried openphpfile:blast and it worked pretty well :)

EDIT:

The problem with this solution is that% 1 is replaced with "open_php_file: // [file]" instead of "[file]". This way I need some kind of filter that interrupts "open_php_file: //".

enter a space after openphpfile: [Space] Your_Content and change the parameter to% 2, you will get the expected result

 [HKEY_CLASSES_ROOT\openphpfile\shell\open\command] @="\"C:\\Users\\ABC\\Documents\\Programs\\CB\\Chunks\\CGI.exe\" -c \"%2\"" 
+8
source

Windows always replaces% 1 with the full URI that was entered. AFAIK there is no way to change this behavior.

This gives you two options:

  • If you wrote the program you are calling yourself, you can filter the URI when it is called.
  • You can use a middleware that acts as a filter for the URI and then redirects the result to the actual protocol implementation. Luckily for you, someone has already done just that. See ' CustomURL ' in CodePlex. CustomURL is a small utility for registering custom URL protocols. For example, you can associate the rdp: // protocol with the Remote Desktop client or with the ssh: // protocol with Putty or another SSH client.
0
source

All Articles