summaryrefslogtreecommitdiffstats
path: root/src/libirecovery.c
diff options
context:
space:
mode:
authorGravatar Josef Micka2023-03-02 13:46:17 +0100
committerGravatar Nikias Bassen2023-05-08 13:48:05 +0200
commit3b4ef6a3d109702694435087311258355df1b63a (patch)
tree404fa19f1a1ae58dc0a2f08b52af858ffd95f405 /src/libirecovery.c
parent12ed446fb17b8ea34728641cf4ca836eedab7aeb (diff)
downloadlibirecovery-3b4ef6a3d109702694435087311258355df1b63a.tar.gz
libirecovery-3b4ef6a3d109702694435087311258355df1b63a.tar.bz2
win32: Use ANSI versions for SetupDI and CreateFile API to prevent errors when compiling with unicode support
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r--src/libirecovery.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 6741b95..a91a742 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -791,11 +791,11 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, uint64_t ecid) {
_client->DfuPath = NULL;
_client->handle = NULL;
DWORD requiredSize = 0;
- PSP_DEVICE_INTERFACE_DETAIL_DATA details;
- SetupDiGetDeviceInterfaceDetail(usbDevices, &currentInterface, NULL, 0, &requiredSize, NULL);
- details = (PSP_DEVICE_INTERFACE_DETAIL_DATA) malloc(requiredSize);
- details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
- if(!SetupDiGetDeviceInterfaceDetail(usbDevices, &currentInterface, details, requiredSize, NULL, NULL)) {
+ PSP_DEVICE_INTERFACE_DETAIL_DATA_A details;
+ SetupDiGetDeviceInterfaceDetailA(usbDevices, &currentInterface, NULL, 0, &requiredSize, NULL);
+ details = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A) malloc(requiredSize);
+ details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
+ if(!SetupDiGetDeviceInterfaceDetailA(usbDevices, &currentInterface, details, requiredSize, NULL, NULL)) {
free(details);
continue;
} else {
@@ -884,11 +884,11 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, uint64_t ecid) {
_client->iBootPath = NULL;
_client->handle = NULL;
DWORD requiredSize = 0;
- PSP_DEVICE_INTERFACE_DETAIL_DATA details;
- SetupDiGetDeviceInterfaceDetail(usbDevices, &currentInterface, NULL, 0, &requiredSize, NULL);
- details = (PSP_DEVICE_INTERFACE_DETAIL_DATA) malloc(requiredSize);
- details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
- if(!SetupDiGetDeviceInterfaceDetail(usbDevices, &currentInterface, details, requiredSize, NULL, NULL)) {
+ PSP_DEVICE_INTERFACE_DETAIL_DATA_A details;
+ SetupDiGetDeviceInterfaceDetailA(usbDevices, &currentInterface, NULL, 0, &requiredSize, NULL);
+ details = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A) malloc(requiredSize);
+ details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
+ if(!SetupDiGetDeviceInterfaceDetailA(usbDevices, &currentInterface, details, requiredSize, NULL, NULL)) {
free(details);
continue;
} else {
@@ -965,12 +965,12 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, uint64_t ecid) {
}
irecv_error_t mobiledevice_openpipes(irecv_client_t client) {
- if (client->iBootPath && !(client->hIB = CreateFile(client->iBootPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL))) {
+ if (client->iBootPath && !(client->hIB = CreateFileA(client->iBootPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL))) {
irecv_close(client);
return IRECV_E_UNABLE_TO_CONNECT;
}
- if (client->DfuPath && !(client->hDFU = CreateFile(client->DfuPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL))) {
+ if (client->DfuPath && !(client->hDFU = CreateFileA(client->DfuPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL))) {
irecv_close(client);
return IRECV_E_UNABLE_TO_CONNECT;
}
@@ -1860,7 +1860,7 @@ struct irecv_usb_device_info {
#ifdef WIN32
struct irecv_win_dev_ctx {
- PSP_DEVICE_INTERFACE_DETAIL_DATA details;
+ PSP_DEVICE_INTERFACE_DETAIL_DATA_A details;
uint32_t location;
};
#else
@@ -1934,7 +1934,7 @@ static void* _irecv_handle_device_add(void *userdata)
memset(serial_str, 0, 256);
#ifdef WIN32
struct irecv_win_dev_ctx *win_ctx = (struct irecv_win_dev_ctx*)userdata;
- PSP_DEVICE_INTERFACE_DETAIL_DATA details = win_ctx->details;
+ PSP_DEVICE_INTERFACE_DETAIL_DATA_A details = win_ctx->details;
LPSTR result = (LPSTR)details->DevicePath;
location = win_ctx->location;
@@ -2224,13 +2224,13 @@ static void *_irecv_event_handler(void* data)
currentInterface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
for (i = 0; usbDevices && SetupDiEnumDeviceInterfaces(usbDevices, NULL, guids[k], i, &currentInterface); i++) {
DWORD requiredSize = 0;
- PSP_DEVICE_INTERFACE_DETAIL_DATA details;
+ PSP_DEVICE_INTERFACE_DETAIL_DATA_A details;
SetupDiGetDeviceInterfaceDetail(usbDevices, &currentInterface, NULL, 0, &requiredSize, NULL);
- details = (PSP_DEVICE_INTERFACE_DETAIL_DATA) malloc(requiredSize);
- details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
+ details = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A) malloc(requiredSize);
+ details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
SP_DEVINFO_DATA devinfodata;
devinfodata.cbSize = sizeof(SP_DEVINFO_DATA);
- if(!SetupDiGetDeviceInterfaceDetail(usbDevices, &currentInterface, details, requiredSize, NULL, &devinfodata)) {
+ if(!SetupDiGetDeviceInterfaceDetailA(usbDevices, &currentInterface, details, requiredSize, NULL, &devinfodata)) {
free(details);
continue;
}
@@ -2238,7 +2238,7 @@ static void *_irecv_event_handler(void* data)
DWORD sz = REG_SZ;
char driver[256];
driver[0] = '\0';
- if (!SetupDiGetDeviceRegistryProperty(usbDevices, &devinfodata, SPDRP_DRIVER, &sz, (PBYTE)driver, sizeof(driver), NULL)) {
+ if (!SetupDiGetDeviceRegistryPropertyA(usbDevices, &devinfodata, SPDRP_DRIVER, &sz, (PBYTE)driver, sizeof(driver), NULL)) {
debug("%s: ERROR: Failed to get driver key\n", __func__);
free(details);
continue;