Removed useless check for registry file version.

This commit is contained in:
Alexandre Julliard 2003-05-02 20:17:32 +00:00
parent abde7d0acf
commit 98cfe58dcf
1 changed files with 11 additions and 69 deletions

View File

@ -1146,79 +1146,21 @@ static int _get_reg_type(void)
return ret; return ret;
} }
#define WINE_REG_VER_ERROR -1
#define WINE_REG_VER_1 0
#define WINE_REG_VER_2 1
#define WINE_REG_VER_OLD 2
#define WINE_REG_VER_UNKNOWN 3
/* return the version of wine registry file [Internal] */
static int _get_wine_registry_file_format_version(LPCSTR fn)
{
FILE *f;
char tmp[50];
int ver;
if ((f=fopen(fn,"rt")) == NULL) {
WARN("Couldn't open %s for reading: %s\n",fn,strerror(errno));
return WINE_REG_VER_ERROR;
}
if (fgets(tmp,50,f) == NULL) {
WARN("Error reading %s: %s\n",fn,strerror(errno));
fclose(f);
return WINE_REG_VER_ERROR;
}
fclose(f);
if (sscanf(tmp,"WINE REGISTRY Version %d",&ver) != 1) return WINE_REG_VER_UNKNOWN;
switch (ver) {
case 1:
return WINE_REG_VER_1;
break;
case 2:
return WINE_REG_VER_2;
break;
default:
return WINE_REG_VER_UNKNOWN;
}
}
/* load the registry file in wine format [Internal] */ /* load the registry file in wine format [Internal] */
static void load_wine_registry(HKEY hkey,LPCSTR fn) static void load_wine_registry(HKEY hkey,LPCSTR fn)
{ {
int file_format; HANDLE file;
if ((file = FILE_CreateFile( fn, GENERIC_READ, 0, NULL, OPEN_EXISTING,
file_format = _get_wine_registry_file_format_version(fn); FILE_ATTRIBUTE_NORMAL, 0, TRUE, DRIVE_UNKNOWN )))
switch (file_format) { {
SERVER_START_REQ( load_registry )
case WINE_REG_VER_1: {
WARN("Unable to load registry file %s: old format which is no longer supported.\n",fn); req->hkey = hkey;
break; req->file = file;
wine_server_call( req );
case WINE_REG_VER_2: {
HANDLE file;
if ((file = FILE_CreateFile( fn, GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0, TRUE, DRIVE_UNKNOWN )))
{
SERVER_START_REQ( load_registry )
{
req->hkey = hkey;
req->file = file;
wine_server_call( req );
}
SERVER_END_REQ;
CloseHandle( file );
}
break;
} }
SERVER_END_REQ;
case WINE_REG_VER_UNKNOWN: CloseHandle( file );
WARN("Unable to load registry file %s: unknown format.\n",fn);
break;
case WINE_REG_VER_ERROR:
break;
} }
} }