Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7dc45bd8
Commit
7dc45bd8
authored
Sep 19, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Sep 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gameux: Use CRT allocation functions.
parent
9d6a3845
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
34 deletions
+29
-34
gameexplorer.c
dlls/gameux/gameexplorer.c
+22
-27
gamestatistics.c
dlls/gameux/gamestatistics.c
+6
-6
gameux_private.h
dlls/gameux/gameux_private.h
+1
-1
No files found.
dlls/gameux/gameexplorer.c
View file @
7dc45bd8
...
@@ -66,8 +66,8 @@ static void GAMEUX_initGameData(struct GAMEUX_GAME_DATA *GameData)
...
@@ -66,8 +66,8 @@ static void GAMEUX_initGameData(struct GAMEUX_GAME_DATA *GameData)
*/
*/
static
void
GAMEUX_uninitGameData
(
struct
GAMEUX_GAME_DATA
*
GameData
)
static
void
GAMEUX_uninitGameData
(
struct
GAMEUX_GAME_DATA
*
GameData
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
GameData
->
sGDFBinaryPath
);
free
(
GameData
->
sGDFBinaryPath
);
HeapFree
(
GetProcessHeap
(),
0
,
GameData
->
sGameInstallDirectory
);
free
(
GameData
->
sGameInstallDirectory
);
SysFreeString
(
GameData
->
bstrName
);
SysFreeString
(
GameData
->
bstrName
);
SysFreeString
(
GameData
->
bstrDescription
);
SysFreeString
(
GameData
->
bstrDescription
);
}
}
...
@@ -109,7 +109,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -109,7 +109,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
pTokenUser
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwLength
);
pTokenUser
=
malloc
(
dwLength
);
if
(
!
pTokenUser
)
if
(
!
pTokenUser
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
...
@@ -128,7 +128,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -128,7 +128,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
LocalFree
(
lpSID
);
LocalFree
(
lpSID
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pTokenUser
);
free
(
pTokenUser
);
CloseHandle
(
hToken
);
CloseHandle
(
hToken
);
}
}
}
}
...
@@ -153,14 +153,11 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -153,14 +153,11 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
*
lpRegistryPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
sRegistryPath
)
+
1
)
*
sizeof
(
WCHAR
)
);
*
lpRegistryPath
=
wcsdup
(
sRegistryPath
);
if
(
!*
lpRegistryPath
)
if
(
!*
lpRegistryPath
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
lstrcpyW
(
*
lpRegistryPath
,
sRegistryPath
);
TRACE
(
"result: 0x%lx, path: %s
\n
"
,
hr
,
debugstr_w
(
*
lpRegistryPath
));
TRACE
(
"result: 0x%lx, path: %s
\n
"
,
hr
,
debugstr_w
(
*
lpRegistryPath
));
return
hr
;
return
hr
;
}
}
...
@@ -246,7 +243,7 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
...
@@ -246,7 +243,7 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryKey
);
free
(
lpRegistryKey
);
TRACE
(
"returning 0x%lx
\n
"
,
hr
);
TRACE
(
"returning 0x%lx
\n
"
,
hr
);
return
hr
;
return
hr
;
}
}
...
@@ -464,7 +461,7 @@ static HRESULT GAMEUX_RemoveRegistryRecord(GUID* pInstanceID)
...
@@ -464,7 +461,7 @@ static HRESULT GAMEUX_RemoveRegistryRecord(GUID* pInstanceID)
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegDeleteKeyExW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
KEY_WOW64_64KEY
,
0
));
hr
=
HRESULT_FROM_WIN32
(
RegDeleteKeyExW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
KEY_WOW64_64KEY
,
0
));
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
free
(
lpRegistryPath
);
/* if not, check current user */
/* if not, check current user */
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
...
@@ -473,7 +470,7 @@ static HRESULT GAMEUX_RemoveRegistryRecord(GUID* pInstanceID)
...
@@ -473,7 +470,7 @@ static HRESULT GAMEUX_RemoveRegistryRecord(GUID* pInstanceID)
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegDeleteKeyExW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
KEY_WOW64_64KEY
,
0
));
hr
=
HRESULT_FROM_WIN32
(
RegDeleteKeyExW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
KEY_WOW64_64KEY
,
0
));
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
free
(
lpRegistryPath
);
}
}
return
hr
;
return
hr
;
...
@@ -506,10 +503,8 @@ static HRESULT GAMEUX_RegisterGame(LPCWSTR sGDFBinaryPath,
...
@@ -506,10 +503,8 @@ static HRESULT GAMEUX_RegisterGame(LPCWSTR sGDFBinaryPath,
TRACE
(
"(%s, %s, 0x%x, %s)
\n
"
,
debugstr_w
(
sGDFBinaryPath
),
debugstr_w
(
sGameInstallDirectory
),
installScope
,
debugstr_guid
(
pInstanceID
));
TRACE
(
"(%s, %s, 0x%x, %s)
\n
"
,
debugstr_w
(
sGDFBinaryPath
),
debugstr_w
(
sGameInstallDirectory
),
installScope
,
debugstr_guid
(
pInstanceID
));
GAMEUX_initGameData
(
&
GameData
);
GAMEUX_initGameData
(
&
GameData
);
GameData
.
sGDFBinaryPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
sGDFBinaryPath
)
+
1
)
*
sizeof
(
WCHAR
));
GameData
.
sGDFBinaryPath
=
wcsdup
(
sGDFBinaryPath
);
lstrcpyW
(
GameData
.
sGDFBinaryPath
,
sGDFBinaryPath
);
GameData
.
sGameInstallDirectory
=
wcsdup
(
sGameInstallDirectory
);
GameData
.
sGameInstallDirectory
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
sGameInstallDirectory
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
GameData
.
sGameInstallDirectory
,
sGameInstallDirectory
);
GameData
.
installScope
=
installScope
;
GameData
.
installScope
=
installScope
;
/* generate GUID if it was not provided by user */
/* generate GUID if it was not provided by user */
...
@@ -562,7 +557,7 @@ done:
...
@@ -562,7 +557,7 @@ done:
* InstanceID [I] game instance identifier
* InstanceID [I] game instance identifier
* lpRegistryPath [O] place to store address of registry path to
* lpRegistryPath [O] place to store address of registry path to
* the game. It is filled only if key exists.
* the game. It is filled only if key exists.
* It must be freed by
HeapFree(GetProcessHeap(), 0,
...)
* It must be freed by
free(
...)
*
*
* Returns:
* Returns:
* S_OK key was found properly
* S_OK key was found properly
...
@@ -590,7 +585,7 @@ static HRESULT GAMEUX_IsGameKeyExist(GAME_INSTALL_SCOPE installScope,
...
@@ -590,7 +585,7 @@ static HRESULT GAMEUX_IsGameKeyExist(GAME_INSTALL_SCOPE installScope,
else
else
{
{
/* if the key does not exist or another error occurred, do not return the path */
/* if the key does not exist or another error occurred, do not return the path */
HeapFree
(
GetProcessHeap
(),
0
,
*
lpRegistryPath
);
free
(
*
lpRegistryPath
);
*
lpRegistryPath
=
NULL
;
*
lpRegistryPath
=
NULL
;
}
}
...
@@ -616,7 +611,7 @@ static HRESULT GAMEUX_LoadRegistryString(HKEY hRootKey,
...
@@ -616,7 +611,7 @@ static HRESULT GAMEUX_LoadRegistryString(HKEY hRootKey,
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
*
lpValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
*
lpValue
=
malloc
(
dwSize
);
if
(
!*
lpValue
)
if
(
!*
lpValue
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
...
@@ -680,11 +675,11 @@ static HRESULT GAMEUX_UpdateGame(LPGUID InstanceID) {
...
@@ -680,11 +675,11 @@ static HRESULT GAMEUX_UpdateGame(LPGUID InstanceID) {
hr
=
GAMEUX_RegisterGame
(
lpGDFBinaryPath
,
lpGameInstallDirectory
,
hr
=
GAMEUX_RegisterGame
(
lpGDFBinaryPath
,
lpGameInstallDirectory
,
installScope
,
InstanceID
);
installScope
,
InstanceID
);
HeapFree
(
GetProcessHeap
(),
0
,
lpGDFBinaryPath
);
free
(
lpGDFBinaryPath
);
HeapFree
(
GetProcessHeap
(),
0
,
lpGameInstallDirectory
);
free
(
lpGameInstallDirectory
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
free
(
lpRegistryPath
);
TRACE
(
"returning 0x%lx
\n
"
,
hr
);
TRACE
(
"returning 0x%lx
\n
"
,
hr
);
return
hr
;
return
hr
;
}
}
...
@@ -720,7 +715,7 @@ HRESULT GAMEUX_FindGameInstanceId(
...
@@ -720,7 +715,7 @@ HRESULT GAMEUX_FindGameInstanceId(
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
++
dwMaxSubKeyLen
;
/* for string terminator */
++
dwMaxSubKeyLen
;
/* for string terminator */
lpName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
WCHAR
));
lpName
=
malloc
(
dwMaxSubKeyLen
*
sizeof
(
WCHAR
));
if
(
!
lpName
)
hr
=
E_OUTOFMEMORY
;
if
(
!
lpName
)
hr
=
E_OUTOFMEMORY
;
}
}
...
@@ -744,16 +739,16 @@ HRESULT GAMEUX_FindGameInstanceId(
...
@@ -744,16 +739,16 @@ HRESULT GAMEUX_FindGameInstanceId(
hr
=
CLSIDFromString
(
lpName
,
pInstanceId
);
hr
=
CLSIDFromString
(
lpName
,
pInstanceId
);
found
=
TRUE
;
found
=
TRUE
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpValue
);
free
(
lpValue
);
}
}
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpName
);
free
(
lpName
);
RegCloseKey
(
hRootKey
);
RegCloseKey
(
hRootKey
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
free
(
lpRegistryPath
);
if
((
SUCCEEDED
(
hr
)
&&
!
found
)
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
))
if
((
SUCCEEDED
(
hr
)
&&
!
found
)
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
))
hr
=
S_FALSE
;
hr
=
S_FALSE
;
...
@@ -833,7 +828,7 @@ static ULONG WINAPI GameExplorerImpl_Release(IGameExplorer *iface)
...
@@ -833,7 +828,7 @@ static ULONG WINAPI GameExplorerImpl_Release(IGameExplorer *iface)
if
(
ref
==
0
)
if
(
ref
==
0
)
{
{
TRACE
(
"freeing GameExplorer object
\n
"
);
TRACE
(
"freeing GameExplorer object
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -1003,7 +998,7 @@ HRESULT GameExplorer_create(
...
@@ -1003,7 +998,7 @@ HRESULT GameExplorer_create(
TRACE
(
"(%p, %p)
\n
"
,
pUnkOuter
,
ppObj
);
TRACE
(
"(%p, %p)
\n
"
,
pUnkOuter
,
ppObj
);
pGameExplorer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
pGameExplorer
));
pGameExplorer
=
malloc
(
sizeof
(
*
pGameExplorer
));
if
(
!
pGameExplorer
)
if
(
!
pGameExplorer
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
...
dlls/gameux/gamestatistics.c
View file @
7dc45bd8
...
@@ -382,7 +382,7 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
...
@@ -382,7 +382,7 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
free
(
lpRegistryPath
);
TRACE
(
"found app id: %s, return: %#lx
\n
"
,
debugstr_w
(
lpApplicationId
),
hr
);
TRACE
(
"found app id: %s, return: %#lx
\n
"
,
debugstr_w
(
lpApplicationId
),
hr
);
return
hr
;
return
hr
;
...
@@ -687,7 +687,7 @@ static ULONG WINAPI GameStatisticsImpl_Release(IGameStatistics *iface)
...
@@ -687,7 +687,7 @@ static ULONG WINAPI GameStatisticsImpl_Release(IGameStatistics *iface)
if
(
ref
==
0
)
if
(
ref
==
0
)
{
{
TRACE
(
"freeing IGameStatistics
\n
"
);
TRACE
(
"freeing IGameStatistics
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -969,7 +969,7 @@ static HRESULT create_IGameStatistics(GameStatisticsImpl** ppStats)
...
@@ -969,7 +969,7 @@ static HRESULT create_IGameStatistics(GameStatisticsImpl** ppStats)
{
{
TRACE
(
"(%p)
\n
"
,
ppStats
);
TRACE
(
"(%p)
\n
"
,
ppStats
);
*
ppStats
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
**
ppStats
));
*
ppStats
=
calloc
(
1
,
sizeof
(
**
ppStats
));
if
(
!
(
*
ppStats
))
if
(
!
(
*
ppStats
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1043,7 +1043,7 @@ static ULONG WINAPI GameStatisticsMgrImpl_Release(IGameStatisticsMgr *iface)
...
@@ -1043,7 +1043,7 @@ static ULONG WINAPI GameStatisticsMgrImpl_Release(IGameStatisticsMgr *iface)
if
(
ref
==
0
)
if
(
ref
==
0
)
{
{
TRACE
(
"freeing GameStatistics object
\n
"
);
TRACE
(
"freeing GameStatistics object
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -1081,7 +1081,7 @@ static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics(
...
@@ -1081,7 +1081,7 @@ static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics(
*
ppiStats
=
output_iface
;
*
ppiStats
=
output_iface
;
else
else
{
{
HeapFree
(
GetProcessHeap
(),
0
,
statisticsImpl
);
free
(
statisticsImpl
);
*
ppiStats
=
NULL
;
*
ppiStats
=
NULL
;
}
}
...
@@ -1126,7 +1126,7 @@ HRESULT GameStatistics_create(
...
@@ -1126,7 +1126,7 @@ HRESULT GameStatistics_create(
TRACE
(
"(%p, %p)
\n
"
,
pUnkOuter
,
ppObj
);
TRACE
(
"(%p, %p)
\n
"
,
pUnkOuter
,
ppObj
);
pGameStatistics
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
pGameStatistics
)
);
pGameStatistics
=
malloc
(
sizeof
(
*
pGameStatistics
)
);
if
(
!
pGameStatistics
)
if
(
!
pGameStatistics
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
...
dlls/gameux/gameux_private.h
View file @
7dc45bd8
...
@@ -78,7 +78,7 @@ HRESULT GAMEUX_FindGameInstanceId(
...
@@ -78,7 +78,7 @@ HRESULT GAMEUX_FindGameInstanceId(
* lpRegistryPath [O] pointer which will receive address to string
* lpRegistryPath [O] pointer which will receive address to string
* containing expected registry path. Path
* containing expected registry path. Path
* is relative to HKLM registry key. It
* is relative to HKLM registry key. It
* must be freed by calling
HeapFree(GetProcessHeap(), 0,
...)
* must be freed by calling
free(
...)
*
*
* Name of game's registry key always follows patterns below:
* Name of game's registry key always follows patterns below:
* When game is installed for current user only (installScope is GIS_CURRENT_USER):
* When game is installed for current user only (installScope is GIS_CURRENT_USER):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment