Skip to content

Commit

Permalink
Fixed UnloadThenLoad not working when the module is not already loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementDreptin committed Feb 26, 2023
1 parent 7c84f18 commit b2e989d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,19 @@ HRESULT UnloadThenLoad(const char *modulePath)
{
HRESULT hr = S_OK;

hr = Unload(modulePath);
BOOL isModuleLoaded = FALSE;

hr = IsModuleLoaded(modulePath, &isModuleLoaded);
if (FAILED(hr))
return E_FAIL;

if (isModuleLoaded == TRUE)
{
hr = Unload(modulePath);
if (FAILED(hr))
return E_FAIL;
}

hr = Load(modulePath);
if (FAILED(hr))
return E_FAIL;
Expand Down

0 comments on commit b2e989d

Please sign in to comment.