|
gtoal
|
 |
« Reply #89 on: September 09, 2008, 03:21:16 PM » |
|
Here's a quick template for how to write a C utility that you can invoke from a right-click, and below that are the contents of a .reg file that would point to the binary. I've called it "bury" in this example, since it would bury a file one level deeper in the file tree... It does show a command window for a few seconds, then it closes. (code extracted from a utility I wrote to gpg-encrypt a file on a right click. That one unencrypts it on a double-click)
------- #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h>
int main(int argc, char **argv) { char command[4096]; char *s = command; int rc = 0;
if (argc != 2) { fprintf(stdout, "syntax: bury filename\n"); exit(1); }
/* strip file extension, create subdir of that name, rename file to be inside subdir */ /* take care when file has no extension or the rename fails or it is a link or a drive root */
//rc = system(command); //if (rc != 0) exit(rc);
exit(rc); return(rc); }
---------- Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell] @=""
[HKEY_CLASSES_ROOT\*\shell\bury] @="Bury"
[HKEY_CLASSES_ROOT\*\shell\bury\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ 00,5c,00,67,00,70,00,67,00,65,00,6e,00,63,00,72,00,79,00,70,00,74,00,2e,00,\ 65,00,78,00,65,00,20,00,22,00,25,00,31,00,22,00,00,00
[HKEY_CLASSES_ROOT\Applications\bury.exe]
[HKEY_CLASSES_ROOT\Applications\bury.exe\shell]
[HKEY_CLASSES_ROOT\Applications\bury.exe\shell\open]
[HKEY_CLASSES_ROOT\Applications\bury.exe\shell\open\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ 00,5c,00,62,00,75,00,72,00,79,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,00,\ 31,00,22,00,00,00
|