[PATCH 1/6] joy.cpl: Use msvcrt memory allocation functions.

Rémi Bernon rbernon at codeweavers.com
Thu Sep 23 07:01:50 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

A bit of cleanup and improvements to joy.cpl to ultimately make it
possible to override XInput / DInput HID device association with the
registry DirectInput settings, and have it configurable through the
control panel.

 dlls/joy.cpl/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index 3ea417843f4..226f36051a6 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -112,7 +112,7 @@ static void initialize_joysticks(struct JoystickData *data)
     data->num_joysticks = 0;
     data->cur_joystick = 0;
     IDirectInput8_EnumDevices(data->di, DI8DEVCLASS_GAMECTRL, enum_callback, data, DIEDFL_ATTACHEDONLY);
-    data->joysticks = HeapAlloc(GetProcessHeap(), 0, sizeof(struct Joystick) * data->num_joysticks);
+    data->joysticks = malloc(sizeof(struct Joystick) * data->num_joysticks);
 
     /* Get all the joysticks */
     IDirectInput8_EnumDevices(data->di, DI8DEVCLASS_GAMECTRL, enum_callback, data, DIEDFL_ATTACHEDONLY);
@@ -134,14 +134,14 @@ static void destroy_joysticks(struct JoystickData *data)
                 if (data->joysticks[i].effects[j].effect)
                     IDirectInputEffect_Release(data->joysticks[i].effects[j].effect);
 
-            HeapFree(GetProcessHeap(), 0, data->joysticks[i].effects);
+            free(data->joysticks[i].effects);
         }
 
         IDirectInputDevice8_Unacquire(data->joysticks[i].device);
         IDirectInputDevice8_Release(data->joysticks[i].device);
     }
 
-    HeapFree(GetProcessHeap(), 0, data->joysticks);
+    free(data->joysticks);
 }
 
 static void initialize_joysticks_list(HWND hwnd, struct JoystickData *data)
@@ -823,7 +823,7 @@ static INT_PTR CALLBACK ff_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
                     joy->num_effects = 0;
                     joy->effects = NULL;
                     IDirectInputDevice8_EnumEffects(joy->device, ff_effects_callback, (void *) joy, 0);
-                    joy->effects = HeapAlloc(GetProcessHeap(), 0, sizeof(struct Effect) * joy->num_effects);
+                    joy->effects = malloc(sizeof(struct Effect) * joy->num_effects);
 
                     joy->cur_effect = 0;
                     IDirectInputDevice8_EnumEffects(joy->device, ff_effects_callback, (void*) joy, 0);
-- 
2.33.0




More information about the wine-devel mailing list