Commit 5bbf1d10 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winebus.sys: Use new unixlib subsystem.

parent cc2f6693
MODULE = winebus.sys
IMPORTS = ntoskrnl advapi32
EXTRALIBS = $(IOKIT_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS)
EXTRALIBS = $(IOKIT_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) -Wl,--subsystem,unixlib
EXTRAINCL = $(UDEV_CFLAGS) $(SDL2_CFLAGS)
EXTRADLLFLAGS = -mno-cygwin -Wl,--subsystem,native
......
......@@ -370,7 +370,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
else WARN("failed to find device for iohid device %p\n", IOHIDDevice);
}
NTSTATUS WINAPI iohid_bus_init(void *args)
NTSTATUS iohid_bus_init(void *args)
{
TRACE("args %p\n", args);
......@@ -391,7 +391,7 @@ NTSTATUS WINAPI iohid_bus_init(void *args)
return STATUS_SUCCESS;
}
NTSTATUS WINAPI iohid_bus_wait(void *args)
NTSTATUS iohid_bus_wait(void *args)
{
struct bus_event *result = args;
CFRunLoopRunResult ret;
......@@ -415,7 +415,7 @@ NTSTATUS WINAPI iohid_bus_wait(void *args)
return STATUS_SUCCESS;
}
NTSTATUS WINAPI iohid_bus_stop(void *args)
NTSTATUS iohid_bus_stop(void *args)
{
if (!run_loop) return STATUS_SUCCESS;
......@@ -426,19 +426,19 @@ NTSTATUS WINAPI iohid_bus_stop(void *args)
#else
NTSTATUS WINAPI iohid_bus_init(void *args)
NTSTATUS iohid_bus_init(void *args)
{
WARN("IOHID support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI iohid_bus_wait(void *args)
NTSTATUS iohid_bus_wait(void *args)
{
WARN("IOHID support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI iohid_bus_stop(void *args)
NTSTATUS iohid_bus_stop(void *args)
{
WARN("IOHID support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
......
......@@ -810,7 +810,7 @@ static void process_device_event(SDL_Event *event)
pthread_mutex_unlock(&sdl_cs);
}
NTSTATUS WINAPI sdl_bus_init(void *args)
NTSTATUS sdl_bus_init(void *args)
{
const char *mapping;
int i;
......@@ -913,7 +913,7 @@ failed:
return STATUS_UNSUCCESSFUL;
}
NTSTATUS WINAPI sdl_bus_wait(void *args)
NTSTATUS sdl_bus_wait(void *args)
{
struct bus_event *result = args;
SDL_Event event;
......@@ -935,7 +935,7 @@ NTSTATUS WINAPI sdl_bus_wait(void *args)
return STATUS_SUCCESS;
}
NTSTATUS WINAPI sdl_bus_stop(void *args)
NTSTATUS sdl_bus_stop(void *args)
{
SDL_Event event;
......@@ -953,19 +953,19 @@ NTSTATUS WINAPI sdl_bus_stop(void *args)
#else
NTSTATUS WINAPI sdl_bus_init(void *args)
NTSTATUS sdl_bus_init(void *args)
{
WARN("SDL support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI sdl_bus_wait(void *args)
NTSTATUS sdl_bus_wait(void *args)
{
WARN("SDL support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI sdl_bus_stop(void *args)
NTSTATUS sdl_bus_stop(void *args)
{
WARN("SDL support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
......
......@@ -1181,7 +1181,7 @@ static void process_monitor_event(struct udev_monitor *monitor)
udev_device_unref(dev);
}
NTSTATUS WINAPI udev_bus_init(void *args)
NTSTATUS udev_bus_init(void *args)
{
int monitor_fd;
......@@ -1226,7 +1226,7 @@ error:
return STATUS_UNSUCCESSFUL;
}
NTSTATUS WINAPI udev_bus_wait(void *args)
NTSTATUS udev_bus_wait(void *args)
{
struct platform_private *device;
struct bus_event *result = args;
......@@ -1272,7 +1272,7 @@ NTSTATUS WINAPI udev_bus_wait(void *args)
return STATUS_SUCCESS;
}
NTSTATUS WINAPI udev_bus_stop(void *args)
NTSTATUS udev_bus_stop(void *args)
{
if (!udev_context) return STATUS_SUCCESS;
write(deviceloop_control[1], "q", 1);
......@@ -1281,19 +1281,19 @@ NTSTATUS WINAPI udev_bus_stop(void *args)
#else
NTSTATUS WINAPI udev_bus_init(void *args)
NTSTATUS udev_bus_init(void *args)
{
WARN("UDEV support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI udev_bus_wait(void *args)
NTSTATUS udev_bus_wait(void *args)
{
WARN("UDEV support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI udev_bus_stop(void *args)
NTSTATUS udev_bus_stop(void *args)
{
WARN("UDEV support not compiled in!\n");
return STATUS_NOT_IMPLEMENTED;
......
......@@ -112,11 +112,11 @@ static CRITICAL_SECTION device_list_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
static struct list device_list = LIST_INIT(device_list);
static HMODULE instance;
static const unix_entry_point *unix_funcs;
static unixlib_handle_t winebus_handle;
static NTSTATUS winebus_call(unsigned int code, void *args)
{
return unix_funcs[code]( args );
return __wine_unix_call(winebus_handle, code, args);
}
static void unix_device_remove(DEVICE_OBJECT *device)
......@@ -1116,7 +1116,8 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
TRACE( "(%p, %s)\n", driver, debugstr_w(path->Buffer) );
RtlPcToFileHeader(&DriverEntry, (void *)&instance);
if ((ret = __wine_init_unix_lib(instance, DLL_PROCESS_ATTACH, NULL, &unix_funcs)))
if ((ret = NtQueryVirtualMemory(GetCurrentProcess(), instance, MemoryWineUnixFuncs,
&winebus_handle, sizeof(winebus_handle), NULL)))
return ret;
attr.Length = sizeof(attr);
......
......@@ -49,17 +49,17 @@ struct unix_device
extern void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI sdl_bus_init(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI sdl_bus_wait(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI sdl_bus_stop(void *) DECLSPEC_HIDDEN;
extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN;
extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN;
extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI udev_bus_init(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI udev_bus_wait(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI udev_bus_stop(void *) DECLSPEC_HIDDEN;
extern NTSTATUS udev_bus_init(void *) DECLSPEC_HIDDEN;
extern NTSTATUS udev_bus_wait(void *) DECLSPEC_HIDDEN;
extern NTSTATUS udev_bus_stop(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI iohid_bus_init(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI iohid_bus_wait(void *) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI iohid_bus_stop(void *) DECLSPEC_HIDDEN;
extern NTSTATUS iohid_bus_init(void *) DECLSPEC_HIDDEN;
extern NTSTATUS iohid_bus_wait(void *) DECLSPEC_HIDDEN;
extern NTSTATUS iohid_bus_stop(void *) DECLSPEC_HIDDEN;
extern void bus_event_cleanup(struct bus_event *event) DECLSPEC_HIDDEN;
extern void bus_event_queue_destroy(struct list *queue) DECLSPEC_HIDDEN;
......
......@@ -149,7 +149,7 @@ static const struct device_desc mouse_device_desc =
.serialnumber = {"0000"},
};
static NTSTATUS WINAPI mouse_device_create(void *args)
static NTSTATUS mouse_device_create(void *args)
{
struct device_create_params *params = args;
params->desc = mouse_device_desc;
......@@ -247,7 +247,7 @@ static const struct device_desc keyboard_device_desc =
.serialnumber = {"0000"},
};
static NTSTATUS WINAPI keyboard_device_create(void *args)
static NTSTATUS keyboard_device_create(void *args)
{
struct device_create_params *params = args;
params->desc = keyboard_device_desc;
......@@ -280,7 +280,7 @@ static ULONG unix_device_incref(struct unix_device *iface)
return InterlockedIncrement(&iface->ref);
}
static NTSTATUS WINAPI unix_device_remove(void *args)
static NTSTATUS unix_device_remove(void *args)
{
struct unix_device *iface = args;
iface->vtbl->stop(iface);
......@@ -288,20 +288,20 @@ static NTSTATUS WINAPI unix_device_remove(void *args)
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI unix_device_start(void *args)
static NTSTATUS unix_device_start(void *args)
{
struct unix_device *iface = args;
return iface->vtbl->start(iface);
}
static NTSTATUS WINAPI unix_device_get_report_descriptor(void *args)
static NTSTATUS unix_device_get_report_descriptor(void *args)
{
struct device_descriptor_params *params = args;
struct unix_device *iface = params->iface;
return iface->vtbl->get_report_descriptor(iface, params->buffer, params->length, params->out_length);
}
static NTSTATUS WINAPI unix_device_set_output_report(void *args)
static NTSTATUS unix_device_set_output_report(void *args)
{
struct device_report_params *params = args;
struct unix_device *iface = params->iface;
......@@ -309,7 +309,7 @@ static NTSTATUS WINAPI unix_device_set_output_report(void *args)
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI unix_device_get_feature_report(void *args)
static NTSTATUS unix_device_get_feature_report(void *args)
{
struct device_report_params *params = args;
struct unix_device *iface = params->iface;
......@@ -317,7 +317,7 @@ static NTSTATUS WINAPI unix_device_get_feature_report(void *args)
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI unix_device_set_feature_report(void *args)
static NTSTATUS unix_device_set_feature_report(void *args)
{
struct device_report_params *params = args;
struct unix_device *iface = params->iface;
......@@ -325,7 +325,7 @@ static NTSTATUS WINAPI unix_device_set_feature_report(void *args)
return STATUS_SUCCESS;
}
static const unix_entry_point unix_funcs[] =
const unixlib_entry_t __wine_unix_call_funcs[] =
{
sdl_bus_init,
sdl_bus_wait,
......@@ -430,10 +430,3 @@ BOOL bus_event_queue_pop(struct list *queue, struct bus_event *event)
return TRUE;
}
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
{
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
*(const unix_entry_point **)ptr_out = unix_funcs;
return STATUS_SUCCESS;
}
......@@ -136,8 +136,6 @@ enum unix_funcs
device_set_feature_report,
};
typedef NTSTATUS (WINAPI *unix_entry_point)(void *);
static inline const char *debugstr_device_desc(struct device_desc *desc)
{
if (!desc) return "(null)";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment