Skip to content

Commit

Permalink
change registry key from HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER
Browse files Browse the repository at this point in the history
  • Loading branch information
shkit committed Feb 11, 2021
1 parent d6ff17f commit e752aa7
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions fiber.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* File Inspect and Broking End Resolver -- fiber --
*
* Copyright (C) 1997-2010 Shuichi KITAGUCHI <kit@ysnb.net>
* Copyright (C) 1997-2021 Shuichi KITAGUCHI <kit@ysnb.net>
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -45,6 +45,8 @@
* - eliminate "file:" scheme.
* 18 Jan, 2004 : Version 1.2.3 - DO NOT eliminate "file:" scheme.
* 03 Nov, 2010 : Version 1.2.4 - add Exif format.
* 11 Feb, 2021 : Version 1.3.0 - change registry key HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER
* - add "-h" option.
*/


Expand All @@ -55,7 +57,7 @@
#include <mbstring.h>


#define FIBER_VERSION "1.2.4"
#define FIBER_VERSION "1.3.0"


/* constants */
Expand All @@ -71,6 +73,7 @@
#define STATE_ADDEXT 2

/* registry keys */
#define FIBER_HKEY HKEY_CURRENT_USER
#define FIBER_SUBKEY "SOFTWARE\\GNU\\Fiber"
#define FIBER_SUBKEY_EXTNUM "ExtNum"
#define FIBER_SUBKEY_EXECUTEUNKNOWNEXT "ExecuteUnknownExt"
Expand Down Expand Up @@ -363,7 +366,7 @@ BOOL WriteRegistry( VOID )
DWORD dwDisposition;
char *pt;

ret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
ret = RegCreateKeyEx( FIBER_HKEY,
FIBER_SUBKEY,
0,
"",
Expand Down Expand Up @@ -423,7 +426,7 @@ BOOL InitializeRegistry( VOID )
int i;
char szBuf[64];

ret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
ret = RegCreateKeyEx( FIBER_HKEY,
FIBER_SUBKEY,
0,
"",
Expand Down Expand Up @@ -496,14 +499,14 @@ BOOL ReadRegistry( VOID )
BOOL fRet = TRUE;
int i;

ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
ret = RegOpenKeyEx( FIBER_HKEY,
FIBER_SUBKEY,
0,
KEY_EXECUTE,
&hKey );
if ( ret != ERROR_SUCCESS ){
if ( InitializeRegistry() ){
ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
ret = RegOpenKeyEx( FIBER_HKEY,
FIBER_SUBKEY,
0,
KEY_EXECUTE,
Expand Down Expand Up @@ -648,7 +651,7 @@ int SearchExtension( char *ext )
int i;

for ( i=0; i<iEfs; i++ )
if ( strcmpi(ext,ef[i].szExt) == 0 ) break;
if ( _strcmpi(ext,ef[i].szExt) == 0 ) break;

if ( i == iEfs )
return ( INT_MAX );
Expand Down Expand Up @@ -740,7 +743,7 @@ BOOL SetOption( LPSTR szOption )
}
*pt++ = '\0';

ret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
ret = RegCreateKeyEx( FIBER_HKEY,
FIBER_SUBKEY,
0,
"",
Expand Down Expand Up @@ -832,6 +835,7 @@ VOID PrintUsage( VOID )
printf(" -n show ShowWindow parameter \"nCmdShow\"\n");
printf(" -b verb name of verb(action)\n");
printf(" -d directory working directory\n");
printf(" -h show this message");
}

/*
Expand Down Expand Up @@ -990,6 +994,10 @@ main( int argc, char *argv[] )
printf("Error: directory name is required with \'-b\' option.\n");
fError=TRUE;
}
} else if ( ! strcmp(argv[i], "-h") ) {
/* -h */
PrintUsage();
exit(0);
} else {
/* filename */
if ( strlen(argv[i]) > sizeof(szInputFile) ){
Expand Down

0 comments on commit e752aa7

Please sign in to comment.