winemine: Fix loading program state from registry.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-11-10 21:38:15 +03:00 committed by Alexandre Julliard
parent 6018064d59
commit 136d6755de
1 changed files with 8 additions and 16 deletions

View File

@ -80,38 +80,31 @@ static void LoadBoard( BOARD *p_board )
RegOpenKeyExW( HKEY_CURRENT_USER, registry_key, 0, KEY_QUERY_VALUE, &hkey ); RegOpenKeyExW( HKEY_CURRENT_USER, registry_key, 0, KEY_QUERY_VALUE, &hkey );
size = sizeof( p_board->pos.x ); size = sizeof( p_board->pos.x );
if( !RegQueryValueExW( hkey, xposW, NULL, &type, if( RegQueryValueExW( hkey, xposW, NULL, &type, (BYTE*) &p_board->pos.x, &size ) )
(LPBYTE) &p_board->pos.x, &size ) == ERROR_SUCCESS )
p_board->pos.x = 0; p_board->pos.x = 0;
size = sizeof( p_board->pos.y ); size = sizeof( p_board->pos.y );
if( !RegQueryValueExW( hkey, yposW, NULL, &type, if( RegQueryValueExW( hkey, yposW, NULL, &type, (BYTE*) &p_board->pos.y, &size ) )
(LPBYTE) &p_board->pos.y, &size ) == ERROR_SUCCESS )
p_board->pos.y = 0; p_board->pos.y = 0;
size = sizeof( p_board->rows ); size = sizeof( p_board->rows );
if( !RegQueryValueExW( hkey, heightW, NULL, &type, if( RegQueryValueExW( hkey, heightW, NULL, &type, (BYTE*) &p_board->rows, &size ) )
(LPBYTE) &p_board->rows, &size ) == ERROR_SUCCESS )
p_board->rows = BEGINNER_ROWS; p_board->rows = BEGINNER_ROWS;
size = sizeof( p_board->cols ); size = sizeof( p_board->cols );
if( !RegQueryValueExW( hkey, widthW, NULL, &type, if( RegQueryValueExW( hkey, widthW, NULL, &type, (BYTE*) &p_board->cols, &size ) )
(LPBYTE) &p_board->cols, &size ) == ERROR_SUCCESS )
p_board->cols = BEGINNER_COLS; p_board->cols = BEGINNER_COLS;
size = sizeof( p_board->mines ); size = sizeof( p_board->mines );
if( !RegQueryValueExW( hkey, minesW, NULL, &type, if( RegQueryValueExW( hkey, minesW, NULL, &type, (BYTE*) &p_board->mines, &size ) )
(LPBYTE) &p_board->mines, &size ) == ERROR_SUCCESS )
p_board->mines = BEGINNER_MINES; p_board->mines = BEGINNER_MINES;
size = sizeof( p_board->difficulty ); size = sizeof( p_board->difficulty );
if( !RegQueryValueExW( hkey, difficultyW, NULL, &type, if( RegQueryValueExW( hkey, difficultyW, NULL, &type, (BYTE*) &p_board->difficulty, &size ) )
(LPBYTE) &p_board->difficulty, &size ) == ERROR_SUCCESS )
p_board->difficulty = BEGINNER; p_board->difficulty = BEGINNER;
size = sizeof( p_board->IsMarkQ ); size = sizeof( p_board->IsMarkQ );
if( !RegQueryValueExW( hkey, markW, NULL, &type, if( RegQueryValueExW( hkey, markW, NULL, &type, (BYTE*) &p_board->IsMarkQ, &size ) )
(LPBYTE) &p_board->IsMarkQ, &size ) == ERROR_SUCCESS )
p_board->IsMarkQ = TRUE; p_board->IsMarkQ = TRUE;
for( i = 0; i < 3; i++ ) { for( i = 0; i < 3; i++ ) {
@ -127,8 +120,7 @@ static void LoadBoard( BOARD *p_board )
for( i = 0; i < 3; i++ ) { for( i = 0; i < 3; i++ ) {
wsprintfW( key_name, timeW, i+1 ); wsprintfW( key_name, timeW, i+1 );
size = sizeof( p_board->best_time[i] ); size = sizeof( p_board->best_time[i] );
if( !RegQueryValueExW( hkey, key_name, NULL, &type, if( RegQueryValueExW( hkey, key_name, NULL, &type, (BYTE*) &p_board->best_time[i], &size ) )
(LPBYTE) &p_board->best_time[i], &size ) == ERROR_SUCCESS )
p_board->best_time[i] = 999; p_board->best_time[i] = 999;
} }
RegCloseKey( hkey ); RegCloseKey( hkey );