Fixed warnings and mac build.
authorArmin Novak <anovak@thincast.com>
Thu, 21 Jul 2016 14:51:42 +0000 (16:51 +0200)
committerArmin Novak <armin.novak@thincast.com>
Thu, 6 Oct 2016 11:43:04 +0000 (13:43 +0200)
channels/rdpdr/client/rdpdr_main.c
libfreerdp/codec/color.c
libfreerdp/codec/planar.c
libfreerdp/codec/progressive.c
libfreerdp/gdi/gdi.c
libfreerdp/gdi/region.c
winpr/include/winpr/rpc.h
winpr/libwinpr/rpc/rpc.c

index 2156961..7472b0c 100755 (executable)
@@ -80,19 +80,21 @@ struct _DEVICE_DRIVE_EXT
  *
  * @return 0 on success, otherwise a Win32 error code
  */
-static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL userLoggedOn);
+static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
+        BOOL userLoggedOn);
 
 /**
  * Function description
  *
  * @return 0 on success, otherwise a Win32 error code
  */
-static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr, UINT32 count, UINT32 ids[])
+static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr,
+        UINT32 count, UINT32 ids[])
 {
        UINT32 i;
        wStream* s;
-
        s = Stream_New(NULL, count * sizeof(UINT32) + 8);
+
        if (!s)
        {
                WLog_ERR(TAG, "Stream_New failed!");
@@ -107,15 +109,13 @@ static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr, UINT32 cou
                Stream_Write_UINT32(s, ids[i]);
 
        Stream_SealLength(s);
-
        return rdpdr_send(rdpdr, s);
 }
 
 #ifdef _UWP
 
-void first_hotplug(rdpdrPlugin *rdpdr)
+void first_hotplug(rdpdrPluginrdpdr)
 {
-
 }
 
 static void* drive_hotplug_thread_func(void* arg)
@@ -133,16 +133,17 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
 BOOL check_path(char* path)
 {
        UINT type = GetDriveTypeA(path);
+
        if (!(type == DRIVE_REMOVABLE || type == DRIVE_CDROM || type == DRIVE_REMOTE))
                return FALSE;
+
        return GetVolumeInformationA(path, NULL, 0, NULL, NULL, NULL, NULL, 0);
 }
 
-void first_hotplug(rdpdrPlugin *rdpdr)
+void first_hotplug(rdpdrPluginrdpdr)
 {
        int i;
        char drive_path[5] = { 'c', ':', '\\', '\0' };
-
        DWORD unitmask = GetLogicalDrives();
 
        for (i = 0; i < 26; i++)
@@ -150,7 +151,6 @@ void first_hotplug(rdpdrPlugin *rdpdr)
                if (unitmask & 0x01)
                {
                        RDPDR_DRIVE* drive;
-
                        drive_path[0] = 'A' + i;
                        drive_path[1] = ':';
 
@@ -162,22 +162,23 @@ void first_hotplug(rdpdrPlugin *rdpdr)
                                drive->Path = _strdup(drive_path);
                                drive_path[1] = '\0';
                                drive->Name = _strdup(drive_path);
-                               devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE *)drive, rdpdr->rdpcontext);
+                               devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
+                                                          rdpdr->rdpcontext);
                        }
                }
+
                unitmask = unitmask >> 1;
        }
 }
 
 LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
-       rdpdrPlugin *rdpdr;
+       rdpdrPluginrdpdr;
        PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR)lParam;
        UINT error;
+       rdpdr = (rdpdrPlugin*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
-       rdpdr = (rdpdrPlugin *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
-
-       switch(Msg)
+       switch (Msg)
        {
                case WM_DEVICECHANGE:
                        switch (wParam)
@@ -195,7 +196,6 @@ LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                                                        if (unitmask & 0x01)
                                                        {
                                                                RDPDR_DRIVE* drive;
-
                                                                drive_path[0] = 'A' + i;
                                                                drive_path[1] = ':';
 
@@ -203,19 +203,20 @@ LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                                                                {
                                                                        drive = (RDPDR_DRIVE*) malloc(sizeof(RDPDR_DRIVE));
                                                                        ZeroMemory(drive, sizeof(RDPDR_DRIVE));
-
                                                                        drive->Type = RDPDR_DTYP_FILESYSTEM;
-
                                                                        drive->Path = _strdup(drive_path);
                                                                        drive_path[1] = '\0';
                                                                        drive->Name = _strdup(drive_path);
-                                                                       devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE *)drive, rdpdr->rdpcontext);
+                                                                       devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
+                                                                                                  rdpdr->rdpcontext);
                                                                        rdpdr_send_device_list_announce_request(rdpdr, TRUE);
                                                                }
                                                        }
+
                                                        unitmask = unitmask >> 1;
                                                }
                                        }
+
                                        break;
 
                                case DBT_DEVICEREMOVECOMPLETE:
@@ -225,9 +226,8 @@ LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                                                DWORD unitmask = lpdbv->dbcv_unitmask;
                                                int i, j, count;
                                                char drive_name_upper, drive_name_lower;
-
-                                               ULONG_PTR *keys;
-                                               DEVICE_DRIVE_EXT *device_ext;
+                                               ULONG_PTR* keys;
+                                               DEVICE_DRIVE_EXT* device_ext;
                                                UINT32 ids[1];
 
                                                for (i = 0; i < 26; i++)
@@ -236,53 +236,60 @@ LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                                                        {
                                                                drive_name_upper = 'A' + i;
                                                                drive_name_lower = 'a' + i;
-
                                                                count = ListDictionary_GetKeys(rdpdr->devman->devices, &keys);
 
                                                                for (j = 0; j < count; j++)
                                                                {
-                                                                       device_ext = (DEVICE_DRIVE_EXT *)ListDictionary_GetItemValue(rdpdr->devman->devices, (void *)keys[j]);
-                                                                       if (device_ext->path[0] == drive_name_upper || device_ext->path[0] == drive_name_lower)
+                                                                       device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
+                                                                                        rdpdr->devman->devices, (void*)keys[j]);
+
+                                                                       if (device_ext->path[0] == drive_name_upper
+                                                                           || device_ext->path[0] == drive_name_lower)
                                                                        {
-                                                                               devman_unregister_device(rdpdr->devman, (void *)keys[j]);
+                                                                               devman_unregister_device(rdpdr->devman, (void*)keys[j]);
                                                                                ids[0] = keys[j];
+
                                                                                if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
                                                                                {
                                                                                        // dont end on error, just report ?
-                                                                                       WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!", error);
+                                                                                       WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!",
+                                                                                                error);
                                                                                }
+
                                                                                break;
                                                                        }
                                                                }
                                                        }
+
                                                        unitmask = unitmask >> 1;
                                                }
                                        }
+
                                        break;
 
                                default:
                                        break;
                        }
+
                        break;
 
                default:
                        return DefWindowProc(hWnd, Msg, wParam, lParam);
        }
+
        return DefWindowProc(hWnd, Msg, wParam, lParam);
 }
 
 static void* drive_hotplug_thread_func(void* arg)
 {
-       rdpdrPlugin *rdpdr;
+       rdpdrPluginrdpdr;
        WNDCLASSEX wnd_cls;
        HWND hwnd;
        MSG msg;
        BOOL bRet;
        DEV_BROADCAST_HANDLE NotificationFilter;
        HDEVNOTIFY hDevNotify;
-
-       rdpdr = (rdpdrPlugin *)arg;
-
+       rdpdr = (rdpdrPlugin*)arg;
        /* init windows class */
        wnd_cls.cbSize        = sizeof(WNDCLASSEX);
        wnd_cls.style         = CS_HREDRAW | CS_VREDRAW;
@@ -297,18 +304,17 @@ static void* drive_hotplug_thread_func(void* arg)
        wnd_cls.hInstance     = NULL;
        wnd_cls.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
        RegisterClassEx(&wnd_cls);
-
        /* create window */
        hwnd = CreateWindowEx(0, L"DRIVE_HOTPLUG", NULL,
-                       0, 0, 0, 0, 0,
-                       NULL, NULL, NULL, NULL);
+                             0, 0, 0, 0, 0,
+                             NULL, NULL, NULL, NULL);
        SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)rdpdr);
-
        rdpdr->hotplug_wnd = hwnd;
        /* register device interface to hwnd */
        NotificationFilter.dbch_size = sizeof(DEV_BROADCAST_HANDLE);
        NotificationFilter.dbch_devicetype = DBT_DEVTYP_HANDLE;
-       hDevNotify = RegisterDeviceNotification(hwnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE);
+       hDevNotify = RegisterDeviceNotification(hwnd, &NotificationFilter,
+                                               DEVICE_NOTIFY_WINDOW_HANDLE);
 
        /* message loop */
        while ((bRet = GetMessage(&msg, 0, 0, 0)) != 0)
@@ -325,7 +331,6 @@ static void* drive_hotplug_thread_func(void* arg)
        }
 
        UnregisterDeviceNotification(hDevNotify);
-
        return NULL;
 }
 
@@ -337,11 +342,13 @@ static void* drive_hotplug_thread_func(void* arg)
 static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
 {
        UINT error = CHANNEL_RC_OK;
+
        if (rdpdr->hotplug_wnd && !PostMessage(rdpdr->hotplug_wnd, WM_QUIT, 0, 0))
        {
                error = GetLastError();
                WLog_ERR(TAG, "PostMessage failed with error %lu", error);
        }
+
        return error;
 }
 
@@ -363,24 +370,24 @@ typedef struct _hotplug_dev
  */
 static UINT handle_hotplug(rdpdrPlugin* rdpdr)
 {
-       struct dirent *pDirent;
-       DIR *pDir;
+       struct direntpDirent;
+       DIRpDir;
        char fullpath[PATH_MAX];
        char* szdir = (char*)"/Volumes";
        struct stat buf;
        hotplug_dev dev_array[MAX_USB_DEVICES];
        int count;
-       DEVICE_DRIVE_EXT *device_ext;
-       ULONG_PTR *keys;
+       DEVICE_DRIVE_EXTdevice_ext;
+       ULONG_PTRkeys;
        int i, j;
        int size = 0;
        UINT error;
        UINT32 ids[1];
+       pDir = opendir(szdir);
 
-       pDir = opendir (szdir);
        if (pDir == NULL)
        {
-               printf ("Cannot open directory\n");
+               printf("Cannot open directory\n");
                return ERROR_OPEN_FAILED;
        }
 
@@ -390,29 +397,33 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                {
                        sprintf(fullpath, "%s/%s", szdir, pDirent->d_name);
                        lstat(fullpath, &buf);
-                       if(S_ISDIR(buf.st_mode))
+
+                       if (S_ISDIR(buf.st_mode))
                        {
                                dev_array[size].path = _strdup(fullpath);
+
                                if (!dev_array[size].path)
                                {
-                                       closedir (pDir);
+                                       closedir(pDir);
                                        error = CHANNEL_RC_NO_MEMORY;
                                        goto cleanup;
                                }
+
                                dev_array[size++].to_add = TRUE;
                        }
                }
        }
-       closedir (pDir);
 
+       closedir(pDir);
        /* delete removed devices */
        count = ListDictionary_GetKeys(rdpdr->devman->devices, &keys);
 
        for (j = 0; j < count; j++)
        {
                BOOL dev_found = FALSE;
+               device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
+                                rdpdr->devman->devices, (void*)keys[j]);
 
-               device_ext = (DEVICE_DRIVE_EXT *)ListDictionary_GetItemValue(rdpdr->devman->devices, (void *)keys[j]);
                if (!device_ext)
                        continue;
 
@@ -435,11 +446,13 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
 
                if (!dev_found)
                {
-                       devman_unregister_device(rdpdr->devman, (void *)keys[j]);
+                       devman_unregister_device(rdpdr->devman, (void*)keys[j]);
                        ids[0] = keys[j];
+
                        if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
                        {
-                               WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!", error);
+                               WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!",
+                                        error);
                                goto cleanup;
                        }
                }
@@ -453,8 +466,8 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                if (dev_array[i].to_add)
                {
                        char* name;
-
                        drive = (RDPDR_DRIVE*) calloc(1, sizeof(RDPDR_DRIVE));
+
                        if (!drive)
                        {
                                WLog_ERR(TAG, "calloc failed!");
@@ -463,12 +476,11 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                        }
 
                        drive->Type = RDPDR_DTYP_FILESYSTEM;
-
                        drive->Path = dev_array[i].path;
                        dev_array[i].path = NULL;
-
                        name = strrchr(drive->Path, '/') + 1;
                        drive->Name = _strdup(name);
+
                        if (!drive->Name)
                        {
                                WLog_ERR(TAG, "_strdup failed!");
@@ -477,7 +489,9 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                                error = CHANNEL_RC_NO_MEMORY;
                                goto cleanup;
                        }
-                       if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE *)drive, rdpdr->rdpcontext)))
+
+                       if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
+                                                               rdpdr->rdpcontext)))
                        {
                                WLog_ERR(TAG, "devman_load_device_service failed!");
                                free(drive->Path);
@@ -490,25 +504,26 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
        }
 
 cleanup:
+
        for (i = 0; i < size; i++)
-               free (dev_array[i].path);
+               free(dev_array[i].path);
 
        return error;
- }
+}
 
 
-static void drive_hotplug_fsevent_callback(ConstFSEventStreamRef streamRef, void *clientCallBackInfo,
-                                          size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[],
-                                          const FSEventStreamEventId eventIds[])
+static void drive_hotplug_fsevent_callback(ConstFSEventStreamRef streamRef,
+        void* clientCallBackInfo,
+        size_t numEvents, void* eventPaths, const FSEventStreamEventFlags eventFlags[],
+        const FSEventStreamEventId eventIds[])
 {
        rdpdrPlugin* rdpdr;
        int i;
        UINT error;
-       char **paths = (char**)eventPaths;
-
+       char** paths = (char**)eventPaths;
        rdpdr = (rdpdrPlugin*) clientCallBackInfo;
 
-       for (i=0; i<numEvents; i++)
+       for (i = 0; i < numEvents; i++)
        {
                if (strcmp(paths[i], "/Volumes/") == 0)
                {
@@ -518,14 +533,16 @@ static void drive_hotplug_fsevent_callback(ConstFSEventStreamRef streamRef, void
                        }
                        else
                                rdpdr_send_device_list_announce_request(rdpdr, TRUE);
+
                        return;
                }
        }
 }
 
-void first_hotplug(rdpdrPlugin *rdpdr)
+void first_hotplug(rdpdrPluginrdpdr)
 {
        UINT error;
+
        if ((error = handle_hotplug(rdpdr)))
        {
                WLog_ERR(TAG, "handle_hotplug failed with error %lu!", error);
@@ -536,23 +553,22 @@ static void* drive_hotplug_thread_func(void* arg)
 {
        rdpdrPlugin* rdpdr;
        FSEventStreamRef fsev;
-       UINT error;
-
        rdpdr = (rdpdrPlugin*) arg;
        CFStringRef path = CFSTR("/Volumes/");
-       CFArrayRef pathsToWatch = CFArrayCreate(kCFAllocatorMalloc, (const void**)&path, 1, NULL);
+       CFArrayRef pathsToWatch = CFArrayCreate(kCFAllocatorMalloc, (const void**)&path,
+                                               1, NULL);
        FSEventStreamContext ctx;
        ZeroMemory(&ctx, sizeof(ctx));
        ctx.info = arg;
-       fsev = FSEventStreamCreate(kCFAllocatorMalloc, drive_hotplug_fsevent_callback, &ctx, pathsToWatch, kFSEventStreamEventIdSinceNow, 1, kFSEventStreamCreateFlagNone);
-
+       fsev = FSEventStreamCreate(kCFAllocatorMalloc, drive_hotplug_fsevent_callback,
+                                  &ctx, pathsToWatch, kFSEventStreamEventIdSinceNow, 1,
+                                  kFSEventStreamCreateFlagNone);
        rdpdr->runLoop = CFRunLoopGetCurrent();
        FSEventStreamScheduleWithRunLoop(fsev, rdpdr->runLoop, kCFRunLoopDefaultMode);
        FSEventStreamStart(fsev);
        CFRunLoopRun();
        FSEventStreamStop(fsev);
        FSEventStreamRelease(fsev);
-
        ExitThread(CHANNEL_RC_OK);
        return NULL;
 }
@@ -566,6 +582,7 @@ static void* drive_hotplug_thread_func(void* arg)
 static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
 {
        UINT error;
+
        if (rdpdr->hotplugThread)
        {
                CFRunLoopStop(rdpdr->runLoop);
@@ -576,8 +593,10 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
                        WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
                        return error;
                }
+
                rdpdr->hotplugThread = NULL;
        }
+
        return CHANNEL_RC_OK;
 }
 
@@ -585,7 +604,8 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
 
 #define MAX_USB_DEVICES 100
 
-typedef struct _hotplug_dev {
+typedef struct _hotplug_dev
+{
        char* path;
        BOOL  to_add;
 } hotplug_dev;
@@ -597,7 +617,6 @@ static char* next_line(FILE* fd, size_t* len)
        char* newbuf;
        char* lrbuf;
        int lrsiz;
-
        *len = 0;
        lrsiz = 0;
        lrbuf = NULL;
@@ -606,6 +625,7 @@ static char* next_line(FILE* fd, size_t* len)
        for (;;)
        {
                c = fgetc(fd);
+
                if (ferror(fd))
                        return NULL;
 
@@ -625,11 +645,14 @@ static char* next_line(FILE* fd, size_t* len)
                        {
                                newsiz = lrsiz + 4096;
                                newbuf = realloc(lrbuf, newsiz);
+
                                if (newbuf == NULL)
                                        return NULL;
+
                                lrbuf = newbuf;
                                lrsiz = newsiz;
                        }
+
                        lrbuf[(*len)] = c;
 
                        if (c == '\n')
@@ -684,25 +707,22 @@ static char* get_word(char* str, unsigned int* offset)
  */
 static UINT handle_hotplug(rdpdrPlugin* rdpdr)
 {
-       FILE *f;
+       FILEf;
        size_t len;
-       char *line;
-       char *word;
+       charline;
+       charword;
        unsigned int wlen;
-
        hotplug_dev dev_array[MAX_USB_DEVICES];
        int i, j;
        int size = 0;
-
        int count;
-       DEVICE_DRIVE_EXT *device_ext;
-       ULONG_PTR *keys;
+       DEVICE_DRIVE_EXTdevice_ext;
+       ULONG_PTRkeys;
        UINT32 ids[1];
        UINT error = 0;
-
        memset(dev_array, 0, sizeof(dev_array));
-
        f = fopen("/proc/mounts", "r");
+
        if (f == NULL)
        {
                WLog_ERR(TAG, "fopen failed!");
@@ -712,6 +732,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
        while ((line = next_line(f, &len)))
        {
                wlen = 0;
+
                while ((word = get_word(line, &wlen)))
                {
                        /* copy hotpluged device mount point to the dev_array */
@@ -721,26 +742,28 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                                dev_array[size++].to_add = TRUE;
                        }
                        else
-                               free (word);
+                               free(word);
                }
+
                free(line);
        }
 
        fclose(f);
-
        /* delete removed devices */
        count = ListDictionary_GetKeys(rdpdr->devman->devices, &keys);
 
        for (j = 0; j < count; j++)
        {
                BOOL dev_found = FALSE;
+               device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
+                                rdpdr->devman->devices, (void*)keys[j]);
 
-               device_ext = (DEVICE_DRIVE_EXT *)ListDictionary_GetItemValue(rdpdr->devman->devices, (void *)keys[j]);
                if (!device_ext || !device_ext->path)
                        continue;
 
                /* not plugable device */
-               if (strstr(device_ext->path, "/mnt/") == NULL && strstr(device_ext->path, "/media/") == NULL)
+               if (strstr(device_ext->path, "/mnt/") == NULL
+                   && strstr(device_ext->path, "/media/") == NULL)
                        continue;
 
                for (i = 0; i < size; i++)
@@ -755,11 +778,13 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
 
                if (!dev_found)
                {
-                       devman_unregister_device(rdpdr->devman, (void *)keys[j]);
+                       devman_unregister_device(rdpdr->devman, (void*)keys[j]);
                        ids[0] = keys[j];
+
                        if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
                        {
-                               WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!", error);
+                               WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!",
+                                        error);
                                goto cleanup;
                        }
                }
@@ -773,8 +798,8 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                if (dev_array[i].to_add)
                {
                        char* name;
-
                        drive = (RDPDR_DRIVE*) calloc(1, sizeof(RDPDR_DRIVE));
+
                        if (!drive)
                        {
                                WLog_ERR(TAG, "calloc failed!");
@@ -783,12 +808,11 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                        }
 
                        drive->Type = RDPDR_DTYP_FILESYSTEM;
-
                        drive->Path = dev_array[i].path;
                        dev_array[i].path = NULL;
-
                        name = strrchr(drive->Path, '/') + 1;
                        drive->Name = _strdup(name);
+
                        if (!drive->Name)
                        {
                                WLog_ERR(TAG, "_strdup failed!");
@@ -797,7 +821,9 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
                                error = CHANNEL_RC_NO_MEMORY;
                                goto cleanup;
                        }
-                       if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE *)drive, rdpdr->rdpcontext)))
+
+                       if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
+                                                               rdpdr->rdpcontext)))
                        {
                                WLog_ERR(TAG, "devman_load_device_service failed!");
                                free(drive->Path);
@@ -809,15 +835,17 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
        }
 
 cleanup:
+
        for (i = 0; i < size; i++)
-               free (dev_array[i].path);
+               free(dev_array[i].path);
 
        return error;
 }
 
-void first_hotplug(rdpdrPlugin *rdpdr)
+void first_hotplug(rdpdrPluginrdpdr)
 {
        UINT error;
+
        if ((error = handle_hotplug(rdpdr)))
        {
                WLog_ERR(TAG, "handle_hotplug failed with error %lu!", error);
@@ -833,7 +861,6 @@ static void* drive_hotplug_thread_func(void* arg)
        int rv;
        UINT error = 0;
        DWORD status;
-
        rdpdr = (rdpdrPlugin*) arg;
 
        if (!(rdpdr->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
@@ -857,15 +884,17 @@ static void* drive_hotplug_thread_func(void* arg)
        tv.tv_sec = 1;
        tv.tv_usec = 0;
 
-       while ((rv = select(mfd+1, NULL, NULL, &rfds, &tv)) >= 0)
+       while ((rv = select(mfd + 1, NULL, NULL, &rfds, &tv)) >= 0)
        {
                status = WaitForSingleObject(rdpdr->stopEvent, 0);
+
                if (status == WAIT_FAILED)
                {
                        error = GetLastError();
                        WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
                        goto out;
                }
+
                if (status == WAIT_OBJECT_0)
                        break;
 
@@ -888,8 +917,10 @@ static void* drive_hotplug_thread_func(void* arg)
        }
 
 out:
+
        if (error && rdpdr->rdpcontext)
-               setChannelError(rdpdr->rdpcontext, error, "drive_hotplug_thread_func reported an error");
+               setChannelError(rdpdr->rdpcontext, error,
+                               "drive_hotplug_thread_func reported an error");
 
        CloseHandle(rdpdr->stopEvent);
        ExitThread((DWORD)error);
@@ -916,8 +947,10 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
                        WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
                        return error;
                }
+
                rdpdr->hotplugThread = NULL;
        }
+
        return CHANNEL_RC_OK;
 }
 
@@ -935,8 +968,8 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
        RDPDR_DEVICE* device;
        rdpSettings* settings;
        UINT error = CHANNEL_RC_OK;
-
        rdpdr->devman = devman_new(rdpdr);
+
        if (!rdpdr->devman)
        {
                WLog_ERR(TAG, "devman_new failed!");
@@ -944,10 +977,13 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
        }
 
        settings = (rdpSettings*) rdpdr->channelEntryPoints.pExtendedData;
+
        if (settings->ClientHostname)
-               strncpy(rdpdr->computerName, settings->ClientHostname, sizeof(rdpdr->computerName) - 1);
+               strncpy(rdpdr->computerName, settings->ClientHostname,
+                       sizeof(rdpdr->computerName) - 1);
        else
-               strncpy(rdpdr->computerName, settings->ComputerName, sizeof(rdpdr->computerName) - 1);
+               strncpy(rdpdr->computerName, settings->ComputerName,
+                       sizeof(rdpdr->computerName) - 1);
 
        for (index = 0; index < settings->DeviceCount; index++)
        {
@@ -956,8 +992,9 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
                if (device->Name && (strcmp(device->Name, "*") == 0))
                {
                        first_hotplug(rdpdr);
+
                        if (!(rdpdr->hotplugThread = CreateThread(NULL, 0,
-                                       (LPTHREAD_START_ROUTINE) drive_hotplug_thread_func, rdpdr, 0, NULL)))
+                                                    (LPTHREAD_START_ROUTINE) drive_hotplug_thread_func, rdpdr, 0, NULL)))
                        {
                                WLog_ERR(TAG, "CreateThread failed!");
                                return ERROR_INTERNAL_ERROR;
@@ -966,16 +1003,19 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
                        continue;
                }
 
-               if ((error = devman_load_device_service(rdpdr->devman, device, rdpdr->rdpcontext)))
+               if ((error = devman_load_device_service(rdpdr->devman, device,
+                                                       rdpdr->rdpcontext)))
                {
                        WLog_ERR(TAG, "devman_load_device_service failed with error %lu!", error);
                        return error;
                }
        }
+
        return error;
 }
 
-static UINT rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, wStream* s)
+static UINT rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr,
+        wStream* s)
 {
        if (Stream_GetRemainingLength(s) < 8)
                return ERROR_INVALID_DATA;
@@ -983,9 +1023,7 @@ static UINT rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, wStream* s
        Stream_Read_UINT16(s, rdpdr->versionMajor);
        Stream_Read_UINT16(s, rdpdr->versionMinor);
        Stream_Read_UINT32(s, rdpdr->clientID);
-
        rdpdr->sequenceId++;
-
        return CHANNEL_RC_OK;
 }
 
@@ -997,8 +1035,8 @@ static UINT rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, wStream* s
 static UINT rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
 {
        wStream* s;
-
        s = Stream_New(NULL, 12);
+
        if (!s)
        {
                WLog_ERR(TAG, "Stream_New failed!");
@@ -1007,11 +1045,9 @@ static UINT rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
 
        Stream_Write_UINT16(s, RDPDR_CTYP_CORE); /* Component (2 bytes) */
        Stream_Write_UINT16(s, PAKID_CORE_CLIENTID_CONFIRM); /* PacketId (2 bytes) */
-
        Stream_Write_UINT16(s, rdpdr->versionMajor);
        Stream_Write_UINT16(s, rdpdr->versionMinor);
        Stream_Write_UINT32(s, (UINT32) rdpdr->clientID);
-
        return rdpdr_send(rdpdr, s);
 }
 
@@ -1029,9 +1065,10 @@ static UINT rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
        if (!rdpdr->computerName[0])
                gethostname(rdpdr->computerName, sizeof(rdpdr->computerName) - 1);
 
-       computerNameLenW = ConvertToUnicode(CP_UTF8, 0, rdpdr->computerName, -1, &computerNameW, 0) * 2;
-
+       computerNameLenW = ConvertToUnicode(CP_UTF8, 0, rdpdr->computerName, -1,
+                                           &computerNameW, 0) * 2;
        s = Stream_New(NULL, 16 + computerNameLenW + 2);
+
        if (!s)
        {
                WLog_ERR(TAG, "Stream_New failed!");
@@ -1040,19 +1077,18 @@ static UINT rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
 
        Stream_Write_UINT16(s, RDPDR_CTYP_CORE); /* Component (2 bytes) */
        Stream_Write_UINT16(s, PAKID_CORE_CLIENT_NAME); /* PacketId (2 bytes) */
-
        Stream_Write_UINT32(s, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */
        Stream_Write_UINT32(s, 0); /* codePage, must be set to zero */
-       Stream_Write_UINT32(s, computerNameLenW + 2); /* computerNameLen, including null terminator */
+       Stream_Write_UINT32(s, computerNameLenW +
+                           2); /* computerNameLen, including null terminator */
        Stream_Write(s, computerNameW, computerNameLenW);
        Stream_Write_UINT16(s, 0); /* null terminator */
-
        free(computerNameW);
-
        return rdpdr_send(rdpdr, s);
 }
 
-static UINT rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, wStream* s)
+static UINT rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr,
+        wStream* s)
 {
        UINT16 versionMajor;
        UINT16 versionMinor;
@@ -1082,7 +1118,8 @@ static UINT rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, wStream* s
  *
  * @return 0 on success, otherwise a Win32 error code
  */
-static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL userLoggedOn)
+static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
+        BOOL userLoggedOn)
 {
        int i;
        BYTE c;
@@ -1095,8 +1132,8 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
        DEVICE* device;
        int keyCount;
        ULONG_PTR* pKeys;
-
        s = Stream_New(NULL, 256);
+
        if (!s)
        {
                WLog_ERR(TAG, "Stream_New failed!");
@@ -1105,18 +1142,16 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
 
        Stream_Write_UINT16(s, RDPDR_CTYP_CORE); /* Component (2 bytes) */
        Stream_Write_UINT16(s, PAKID_CORE_DEVICELIST_ANNOUNCE); /* PacketId (2 bytes) */
-
        count_pos = (int) Stream_GetPosition(s);
        count = 0;
-
        Stream_Seek_UINT32(s); /* deviceCount */
-
        pKeys = NULL;
        keyCount = ListDictionary_GetKeys(rdpdr->devman->devices, &pKeys);
 
        for (index = 0; index < keyCount; index++)
        {
-               device = (DEVICE*) ListDictionary_GetItemValue(rdpdr->devman->devices, (void*) pKeys[index]);
+               device = (DEVICE*) ListDictionary_GetItemValue(rdpdr->devman->devices,
+                        (void*) pKeys[index]);
 
                /**
                 * 1. versionMinor 0x0005 doesn't send PAKID_CORE_USER_LOGGEDON
@@ -1126,9 +1161,10 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
                 */
 
                if ((rdpdr->versionMinor == 0x0005) ||
-                               (device->type == RDPDR_DTYP_SMARTCARD) || userLoggedOn)
+                   (device->type == RDPDR_DTYP_SMARTCARD) || userLoggedOn)
                {
-                       data_len = (int) (device->data == NULL ? 0 : Stream_GetPosition(device->data));
+                       data_len = (int)(device->data == NULL ? 0 : Stream_GetPosition(device->data));
+
                        if (!Stream_EnsureRemainingCapacity(s, 20 + data_len))
                        {
                                WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
@@ -1156,18 +1192,16 @@ static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
 
                        count++;
                        WLog_INFO(TAG, "registered device #%d: %s (type=%d id=%d)",
-                                         count, device->name, device->type, device->id);
+                                 count, device->name, device->type, device->id);
                }
        }
 
        free(pKeys);
-
        pos = (int) Stream_GetPosition(s);
        Stream_SetPosition(s, count_pos);
        Stream_Write_UINT32(s, count);
        Stream_SetPosition(s, pos);
        Stream_SealLength(s);
-
        return rdpdr_send(rdpdr, s);
 }
 
@@ -1180,7 +1214,6 @@ static UINT rdpdr_process_irp(rdpdrPlugin* rdpdr, wStream* s)
 {
        IRP* irp;
        UINT error = CHANNEL_RC_OK;
-
        irp = irp_new(rdpdr->devman, s, &error);
 
        if (!irp)
@@ -1209,15 +1242,15 @@ static UINT rdpdr_process_init(rdpdrPlugin* rdpdr)
        DEVICE* device;
        ULONG_PTR* pKeys;
        UINT error = CHANNEL_RC_OK;
-
        pKeys = NULL;
        keyCount = ListDictionary_GetKeys(rdpdr->devman->devices, &pKeys);
 
        for (index = 0; index < keyCount; index++)
        {
-               device = (DEVICE*) ListDictionary_GetItemValue(rdpdr->devman->devices, (void*) pKeys[index]);
-
+               device = (DEVICE*) ListDictionary_GetItemValue(rdpdr->devman->devices,
+                        (void*) pKeys[index]);
                IFCALLRET(device->Init, error, device);
+
                if (error != CHANNEL_RC_OK)
                {
                        WLog_ERR(TAG, "Init failed!");
@@ -1256,107 +1289,121 @@ static UINT rdpdr_process_receive(rdpdrPlugin* rdpdr, wStream* s)
        {
                switch (packetId)
                {
-               case PAKID_CORE_SERVER_ANNOUNCE:
-                       if ((error = rdpdr_process_server_announce_request(rdpdr, s)))
-                               return error;
-                       if ((error = rdpdr_send_client_announce_reply(rdpdr)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_send_client_announce_reply failed with error %lu", error);
-                               return error;
-                       }
-                       if ((error = rdpdr_send_client_name_request(rdpdr)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_send_client_name_request failed with error %lu", error);
-                               return error;
-                       }
-                       if ((error = rdpdr_process_init(rdpdr)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_process_init failed with error %lu", error);
-                               return error;
-                       }
-                       break;
+                       case PAKID_CORE_SERVER_ANNOUNCE:
+                               if ((error = rdpdr_process_server_announce_request(rdpdr, s)))
+                                       return error;
 
-               case PAKID_CORE_SERVER_CAPABILITY:
-                       if ((error = rdpdr_process_capability_request(rdpdr, s)))
-                               return error;
-                       if ((error = rdpdr_send_capability_response(rdpdr)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_send_capability_response failed with error %lu", error);
-                               return error;
-                       }
-                       break;
+                               if ((error = rdpdr_send_client_announce_reply(rdpdr)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_send_client_announce_reply failed with error %lu", error);
+                                       return error;
+                               }
 
-               case PAKID_CORE_CLIENTID_CONFIRM:
-                       if ((error = rdpdr_process_server_clientid_confirm(rdpdr, s)))
-                               return error;
+                               if ((error = rdpdr_send_client_name_request(rdpdr)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_send_client_name_request failed with error %lu", error);
+                                       return error;
+                               }
 
-                       if ((error = rdpdr_send_device_list_announce_request(rdpdr, FALSE)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %lu", error);
-                               return error;
-                       }
-                       break;
+                               if ((error = rdpdr_process_init(rdpdr)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_process_init failed with error %lu", error);
+                                       return error;
+                               }
 
-               case PAKID_CORE_USER_LOGGEDON:
-                       if ((error = rdpdr_send_device_list_announce_request(rdpdr, TRUE)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %lu", error);
-                               return error;
-                       }
-                       break;
+                               break;
 
-               case PAKID_CORE_DEVICE_REPLY:
-                       /* connect to a specific resource */
-                       if (Stream_GetRemainingLength(s) < 8)
-                               return ERROR_INVALID_DATA;
+                       case PAKID_CORE_SERVER_CAPABILITY:
+                               if ((error = rdpdr_process_capability_request(rdpdr, s)))
+                                       return error;
 
-                       Stream_Read_UINT32(s, deviceId);
-                       Stream_Read_UINT32(s, status);
-                       break;
+                               if ((error = rdpdr_send_capability_response(rdpdr)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_send_capability_response failed with error %lu", error);
+                                       return error;
+                               }
 
-               case PAKID_CORE_DEVICE_IOREQUEST:
-                       if ((error = rdpdr_process_irp(rdpdr, s)))
-                       {
-                               WLog_ERR(TAG, "rdpdr_process_irp failed with error %lu", error);
-                               return error;
-                       }
-                       s = NULL;
-                       break;
+                               break;
 
-               default:
-                       WLog_ERR(TAG, "RDPDR_CTYP_CORE unknown PacketId: 0x%04X", packetId);
-                       return ERROR_INVALID_DATA;
-                       break;
+                       case PAKID_CORE_CLIENTID_CONFIRM:
+                               if ((error = rdpdr_process_server_clientid_confirm(rdpdr, s)))
+                                       return error;
+
+                               if ((error = rdpdr_send_device_list_announce_request(rdpdr, FALSE)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %lu",
+                                                error);
+                                       return error;
+                               }
+
+                               break;
+
+                       case PAKID_CORE_USER_LOGGEDON:
+                               if ((error = rdpdr_send_device_list_announce_request(rdpdr, TRUE)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %lu",
+                                                error);
+                                       return error;
+                               }
+
+                               break;
+
+                       case PAKID_CORE_DEVICE_REPLY:
+
+                               /* connect to a specific resource */
+                               if (Stream_GetRemainingLength(s) < 8)
+                                       return ERROR_INVALID_DATA;
+
+                               Stream_Read_UINT32(s, deviceId);
+                               Stream_Read_UINT32(s, status);
+                               break;
 
+                       case PAKID_CORE_DEVICE_IOREQUEST:
+                               if ((error = rdpdr_process_irp(rdpdr, s)))
+                               {
+                                       WLog_ERR(TAG, "rdpdr_process_irp failed with error %lu", error);
+                                       return error;
+                               }
+
+                               s = NULL;
+                               break;
+
+                       default:
+                               WLog_ERR(TAG, "RDPDR_CTYP_CORE unknown PacketId: 0x%04X", packetId);
+                               return ERROR_INVALID_DATA;
+                               break;
                }
        }
        else if (component == RDPDR_CTYP_PRN)
        {
                switch (packetId)
                {
-               case PAKID_PRN_CACHE_DATA:
-               {
-                       UINT32 eventID;
-                       if (Stream_GetRemainingLength(s) < 4)
-                               return ERROR_INVALID_DATA;
+                       case PAKID_PRN_CACHE_DATA:
+                               {
+                                       UINT32 eventID;
 
-                       Stream_Read_UINT32(s, eventID);
-                       WLog_ERR(TAG, "Ignoring unhandled message PAKID_PRN_CACHE_DATA (EventID: 0x%04X)", eventID);
-               }
-                       break;
+                                       if (Stream_GetRemainingLength(s) < 4)
+                                               return ERROR_INVALID_DATA;
 
-               case PAKID_PRN_USING_XPS:
-                       WLog_ERR(TAG, "Ignoring unhandled message PAKID_PRN_USING_XPS");
-                       break;
+                                       Stream_Read_UINT32(s, eventID);
+                                       WLog_ERR(TAG,
+                                                "Ignoring unhandled message PAKID_PRN_CACHE_DATA (EventID: 0x%04X)", eventID);
+                               }
+                               break;
 
-               default:
-                       WLog_ERR(TAG, "Unknown printing component packetID: 0x%04X", packetId);
-                       return ERROR_INVALID_DATA;
+                       case PAKID_PRN_USING_XPS:
+                               WLog_ERR(TAG, "Ignoring unhandled message PAKID_PRN_USING_XPS");
+                               break;
+
+                       default:
+                               WLog_ERR(TAG, "Unknown printing component packetID: 0x%04X", packetId);
+                               return ERROR_INVALID_DATA;
                }
        }
        else
        {
-               WLog_ERR(TAG, "Unknown message: Component: 0x%04X PacketId: 0x%04X", component, packetId);
+               WLog_ERR(TAG, "Unknown message: Component: 0x%04X PacketId: 0x%04X", component,
+                        packetId);
                return ERROR_INVALID_DATA;
        }
 
@@ -1382,6 +1429,7 @@ UINT rdpdr_add_init_handle_data(void* pInitHandle, void* pUserData)
        {
                g_InitHandles = ListDictionary_New(TRUE);
        }
+
        if (!g_InitHandles)
        {
                WLog_ERR(TAG, "ListDictionary_New failed!");
@@ -1393,6 +1441,7 @@ UINT rdpdr_add_init_handle_data(void* pInitHandle, void* pUserData)
                WLog_ERR(TAG, "ListDictionary_Add failed!");
                return ERROR_INTERNAL_ERROR;
        }
+
        return CHANNEL_RC_OK;
 }
 
@@ -1406,6 +1455,7 @@ void* rdpdr_get_init_handle_data(void* pInitHandle)
 void rdpdr_remove_init_handle_data(void* pInitHandle)
 {
        ListDictionary_Remove(g_InitHandles, pInitHandle);
+
        if (ListDictionary_Count(g_InitHandles) < 1)
        {
                ListDictionary_Free(g_InitHandles);
@@ -1420,7 +1470,7 @@ void rdpdr_remove_init_handle_data(void* pInitHandle)
  */
 UINT rdpdr_add_open_handle_data(DWORD openHandle, void* pUserData)
 {
-       void* pOpenHandle = (void*) (size_t) openHandle;
+       void* pOpenHandle = (void*)(size_t) openHandle;
 
        if (!g_OpenHandles)
        {
@@ -1438,21 +1488,23 @@ UINT rdpdr_add_open_handle_data(DWORD openHandle, void* pUserData)
                WLog_ERR(TAG, "ListDictionary_Add failed!");
                return ERROR_INTERNAL_ERROR;
        }
+
        return CHANNEL_RC_OK;
 }
 
 void* rdpdr_get_open_handle_data(DWORD openHandle)
 {
        void* pUserData = NULL;
-       void* pOpenHandle = (void*) (size_t) openHandle;
+       void* pOpenHandle = (void*)(size_t) openHandle;
        pUserData = ListDictionary_GetItemValue(g_OpenHandles, pOpenHandle);
        return pUserData;
 }
 
 void rdpdr_remove_open_handle_data(DWORD openHandle)
 {
-       void* pOpenHandle = (void*) (size_t) openHandle;
+       void* pOpenHandle = (void*)(size_t) openHandle;
        ListDictionary_Remove(g_OpenHandles, pOpenHandle);
+
        if (ListDictionary_Count(g_OpenHandles) < 1)
        {
                ListDictionary_Free(g_OpenHandles);
@@ -1478,14 +1530,14 @@ UINT rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
        else
        {
                status = plugin->channelEntryPoints.pVirtualChannelWrite(plugin->OpenHandle,
-                                                                                                                                Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+                        Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
        }
 
        if (status != CHANNEL_RC_OK)
        {
                Stream_Free(s, TRUE);
                WLog_ERR(TAG,  "VirtualChannelWrite failed with %s [%08X]",
-                                WTSErrorToString(status), status);
+                        WTSErrorToString(status), status);
        }
 
        return status;
@@ -1497,7 +1549,7 @@ UINT rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
  * @return 0 on success, otherwise a Win32 error code
  */
 static UINT rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
-                                                                                                         void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+        void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
 {
        wStream* data_in;
 
@@ -1518,6 +1570,7 @@ static UINT rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
                        Stream_Free(rdpdr->data_in, TRUE);
 
                rdpdr->data_in = Stream_New(NULL, totalLength);
+
                if (!rdpdr->data_in)
                {
                        WLog_ERR(TAG,  "Stream_New failed!");
@@ -1526,11 +1579,13 @@ static UINT rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
        }
 
        data_in = rdpdr->data_in;
+
        if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength))
        {
                WLog_ERR(TAG,  "Stream_EnsureRemainingCapacity failed!");
                return ERROR_INVALID_DATA;
        }
+
        Stream_Write(data_in, pData, dataLength);
 
        if (dataFlags & CHANNEL_FLAG_LAST)
@@ -1551,15 +1606,16 @@ static UINT rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
                        return ERROR_INTERNAL_ERROR;
                }
        }
+
        return CHANNEL_RC_OK;
 }
 
-static VOID VCAPITYPE rdpdr_virtual_channel_open_event(DWORD openHandle, UINT event,
-                                                                                                          LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+static VOID VCAPITYPE rdpdr_virtual_channel_open_event(DWORD openHandle,
+        UINT event,
+        LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
 {
        rdpdrPlugin* rdpdr;
        UINT error = CHANNEL_RC_OK;
-
        rdpdr = (rdpdrPlugin*) rdpdr_get_open_handle_data(openHandle);
 
        if (!rdpdr || !pData)
@@ -1570,20 +1626,25 @@ static VOID VCAPITYPE rdpdr_virtual_channel_open_event(DWORD openHandle, UINT ev
 
        switch (event)
        {
-       case CHANNEL_EVENT_DATA_RECEIVED:
-               if ((error  = rdpdr_virtual_channel_event_data_received(rdpdr, pData, dataLength, totalLength, dataFlags)))
-                       WLog_ERR(TAG,  "rdpdr_virtual_channel_event_data_received failed with error %lu!", error );
-               break;
+               case CHANNEL_EVENT_DATA_RECEIVED:
+                       if ((error  = rdpdr_virtual_channel_event_data_received(rdpdr, pData,
+                                     dataLength, totalLength, dataFlags)))
+                               WLog_ERR(TAG,
+                                        "rdpdr_virtual_channel_event_data_received failed with error %lu!", error);
+
+                       break;
 
-       case CHANNEL_EVENT_WRITE_COMPLETE:
-               Stream_Free((wStream*) pData, TRUE);
-               break;
+               case CHANNEL_EVENT_WRITE_COMPLETE:
+                       Stream_Free((wStream*) pData, TRUE);
+                       break;
 
-       case CHANNEL_EVENT_USER:
-               break;
+               case CHANNEL_EVENT_USER:
+                       break;
        }
+
        if (error && rdpdr->rdpcontext)
-               setChannelError(rdpdr->rdpcontext, error, "rdpdr_virtual_channel_open_event reported an error");
+               setChannelError(rdpdr->rdpcontext, error,
+                               "rdpdr_virtual_channel_open_event reported an error");
 
        return;
 }
@@ -1604,8 +1665,11 @@ static void* rdpdr_virtual_channel_client_thread(void* arg)
        if ((error = rdpdr_process_connect(rdpdr)))
        {
                WLog_ERR(TAG, "rdpdr_process_connect failed with error %lu!", error);
+
                if (rdpdr->rdpcontext)
-                       setChannelError(rdpdr->rdpcontext, error, "rdpdr_virtual_channel_client_thread reported an error");
+                       setChannelError(rdpdr->rdpcontext, error,
+                                       "rdpdr_virtual_channel_client_thread reported an error");
+
                ExitThread((DWORD) error);
                return NULL;
        }
@@ -1623,11 +1687,15 @@ static void* rdpdr_virtual_channel_client_thread(void* arg)
                        if (message.id == 0)
                        {
                                data = (wStream*) message.wParam;
+
                                if ((error = rdpdr_process_receive(rdpdr, data)))
                                {
                                        WLog_ERR(TAG, "rdpdr_process_receive failed with error %lu!", error);
+
                                        if (rdpdr->rdpcontext)
-                                               setChannelError(rdpdr->rdpcontext, error, "rdpdr_virtual_channel_client_thread reported an error");
+                                               setChannelError(rdpdr->rdpcontext, error,
+                                                               "rdpdr_virtual_channel_client_thread reported an error");
+
                                        ExitThread((DWORD) error);
                                        return NULL;
                                }
@@ -1644,18 +1712,18 @@ static void* rdpdr_virtual_channel_client_thread(void* arg)
  *
  * @return 0 on success, otherwise a Win32 error code
  */
-static UINT rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr, LPVOID pData, UINT32 dataLength)
+static UINT rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr,
+        LPVOID pData, UINT32 dataLength)
 {
        UINT32 status;
        UINT error;
-
        status = rdpdr->channelEntryPoints.pVirtualChannelOpen(rdpdr->InitHandle,
-                                                                                                                  &rdpdr->OpenHandle, rdpdr->channelDef.name, rdpdr_virtual_channel_open_event);
+                &rdpdr->OpenHandle, rdpdr->channelDef.name, rdpdr_virtual_channel_open_event);
 
        if (status != CHANNEL_RC_OK)
        {
                WLog_ERR(TAG,  "pVirtualChannelOpen failed with %s [%08X]",
-                                WTSErrorToString(status), status);
+                        WTSErrorToString(status), status);
                return status;
        }
 
@@ -1666,6 +1734,7 @@ static UINT rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr, LPVOID pDa
        }
 
        rdpdr->queue = MessageQueue_New(NULL);
+
        if (!rdpdr->queue)
        {
                WLog_ERR(TAG, "MessageQueue_New failed!");
@@ -1673,11 +1742,13 @@ static UINT rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr, LPVOID pDa
        }
 
        if (!(rdpdr->thread = CreateThread(NULL, 0,
-                       (LPTHREAD_START_ROUTINE) rdpdr_virtual_channel_client_thread, (void*) rdpdr, 0, NULL)))
+                                          (LPTHREAD_START_ROUTINE) rdpdr_virtual_channel_client_thread, (void*) rdpdr, 0,
+                                          NULL)))
        {
                WLog_ERR(TAG, "CreateThread failed!");
                return ERROR_INTERNAL_ERROR;
        }
+
        return CHANNEL_RC_OK;
 }
 
@@ -1690,7 +1761,8 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
 {
        UINT error;
 
-       if (MessageQueue_PostQuit(rdpdr->queue, 0) && (WaitForSingleObject(rdpdr->thread, INFINITE) == WAIT_FAILED))
+       if (MessageQueue_PostQuit(rdpdr->queue, 0)
+           && (WaitForSingleObject(rdpdr->thread, INFINITE) == WAIT_FAILED))
        {
                error = GetLastError();
                WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
@@ -1699,7 +1771,6 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
 
        MessageQueue_Free(rdpdr->queue);
        CloseHandle(rdpdr->thread);
-
        rdpdr->queue = NULL;
        rdpdr->thread = NULL;
 
@@ -1710,10 +1781,11 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
        }
 
        error = rdpdr->channelEntryPoints.pVirtualChannelClose(rdpdr->OpenHandle);
+
        if (CHANNEL_RC_OK != error)
        {
                WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
-                                WTSErrorToString(error), error);
+                        WTSErrorToString(error), error);
        }
 
        if (rdpdr->data_in)
@@ -1735,16 +1807,15 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
 static void rdpdr_virtual_channel_event_terminated(rdpdrPlugin* rdpdr)
 {
        rdpdr_remove_init_handle_data(rdpdr->InitHandle);
-
        free(rdpdr);
 }
 
-static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle, UINT event,
-                                                      LPVOID pData, UINT dataLength)
+static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle,
+        UINT event,
+        LPVOID pData, UINT dataLength)
 {
        rdpdrPlugin* rdpdr;
        UINT error = CHANNEL_RC_OK;
-
        rdpdr = (rdpdrPlugin*) rdpdr_get_init_handle_data(pInitHandle);
 
        if (!rdpdr)
@@ -1755,29 +1826,36 @@ static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle, UINT
 
        switch (event)
        {
-       case CHANNEL_EVENT_INITIALIZED:
-               break;
-       case CHANNEL_EVENT_CONNECTED:
-               if ((error = rdpdr_virtual_channel_event_connected(rdpdr, pData, dataLength)))
-                       WLog_ERR(TAG, "rdpdr_virtual_channel_event_connected failed with error %lu!", error);
-               break;
+               case CHANNEL_EVENT_INITIALIZED:
+                       break;
+
+               case CHANNEL_EVENT_CONNECTED:
+                       if ((error = rdpdr_virtual_channel_event_connected(rdpdr, pData, dataLength)))
+                               WLog_ERR(TAG, "rdpdr_virtual_channel_event_connected failed with error %lu!",
+                                        error);
 
-       case CHANNEL_EVENT_DISCONNECTED:
-               if ((error = rdpdr_virtual_channel_event_disconnected(rdpdr)))
-                       WLog_ERR(TAG, "rdpdr_virtual_channel_event_disconnected failed with error %lu!", error);
-               break;
+                       break;
 
-       case CHANNEL_EVENT_TERMINATED:
-               rdpdr_virtual_channel_event_terminated(rdpdr);
-               break;
-       default:
-               WLog_ERR(TAG, "unknown event %d!", event);
-               error = ERROR_INVALID_DATA;
-               break;
+               case CHANNEL_EVENT_DISCONNECTED:
+                       if ((error = rdpdr_virtual_channel_event_disconnected(rdpdr)))
+                               WLog_ERR(TAG, "rdpdr_virtual_channel_event_disconnected failed with error %lu!",
+                                        error);
+
+                       break;
+
+               case CHANNEL_EVENT_TERMINATED:
+                       rdpdr_virtual_channel_event_terminated(rdpdr);
+                       break;
+
+               default:
+                       WLog_ERR(TAG, "unknown event %d!", event);
+                       error = ERROR_INVALID_DATA;
+                       break;
        }
 
        if (error && rdpdr->rdpcontext)
-               setChannelError(rdpdr->rdpcontext, error, "rdpdr_virtual_channel_init_event reported an error");
+               setChannelError(rdpdr->rdpcontext, error,
+                               "rdpdr_virtual_channel_init_event reported an error");
 }
 
 /* rdpdr is always built-in */
@@ -1788,7 +1866,6 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
        UINT rc;
        rdpdrPlugin* rdpdr;
        CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
-
        rdpdr = (rdpdrPlugin*) calloc(1, sizeof(rdpdrPlugin));
 
        if (!rdpdr)
@@ -1798,32 +1875,29 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
        }
 
        rdpdr->channelDef.options =
-                       CHANNEL_OPTION_INITIALIZED |
-                       CHANNEL_OPTION_ENCRYPT_RDP |
-                       CHANNEL_OPTION_COMPRESS_RDP;
-
+           CHANNEL_OPTION_INITIALIZED |
+           CHANNEL_OPTION_ENCRYPT_RDP |
+           CHANNEL_OPTION_COMPRESS_RDP;
        strcpy(rdpdr->channelDef.name, "rdpdr");
-
        rdpdr->sequenceId = 0;
-
        pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP*) pEntryPoints;
 
        if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP)) &&
-               (pEntryPointsEx->MagicNumber == FREERDP_CHANNEL_MAGIC_NUMBER))
+           (pEntryPointsEx->MagicNumber == FREERDP_CHANNEL_MAGIC_NUMBER))
        {
-
                rdpdr->rdpcontext = pEntryPointsEx->context;
        }
 
-       CopyMemory(&(rdpdr->channelEntryPoints), pEntryPoints, sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
-
+       CopyMemory(&(rdpdr->channelEntryPoints), pEntryPoints,
+                  sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
        rc = rdpdr->channelEntryPoints.pVirtualChannelInit(&rdpdr->InitHandle,
-               &rdpdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000, rdpdr_virtual_channel_init_event);
+               &rdpdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+               rdpdr_virtual_channel_init_event);
 
        if (CHANNEL_RC_OK != rc)
        {
                WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
-                                WTSErrorToString(rc), rc);
+                        WTSErrorToString(rc), rc);
                free(rdpdr);
                return FALSE;
        }
index 4c27f01..d834f7c 100644 (file)
@@ -191,7 +191,7 @@ BOOL freerdp_image_copy_from_pointer_data(
                WLog_ERR(TAG, "Format %s not supported!", GetColorFormatName(DstFormat));
        }
 
-    if (nDstStep <= 0)
+       if (nDstStep <= 0)
                nDstStep = dstBytesPerPixel * nWidth;
 
        nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
@@ -236,7 +236,7 @@ BOOL freerdp_image_copy_from_pointer_data(
 
                        for (x = 0; x < nWidth; x++)
                        {
-                               UINT32 color;
+                               UINT32 color = 0;
                                xorPixel = (*xorBits & xorBit) ? 1 : 0;
 
                                if (!(xorBit >>= 1))
index c1f26b0..d1b1f2c 100644 (file)
@@ -302,7 +302,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
        UINT32 subWidth;
        UINT32 subHeight;
        UINT32 planeSize;
-       UINT32 rleSizes[4];
+       INT32 rleSizes[4];
        UINT32 rawSizes[4];
        UINT32 rawWidths[4];
        UINT32 rawHeights[4];
@@ -314,10 +314,6 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
        const UINT32 w = MIN(nSrcWidth, nDstWidth);
        const UINT32 h = MIN(nSrcHeight, nDstHeight);
        const primitives_t* prims = primitives_get();
-
-       if ((nSrcWidth < 0) || (nSrcHeight < 0))
-               return FALSE;
-
        dstBitsPerPixel = GetBitsPerPixel(DstFormat);
        dstBytesPerPixel = GetBytesPerPixel(DstFormat);
 
index 159e7ff..a4f57bd 100644 (file)
@@ -1556,7 +1556,7 @@ INT32 progressive_decompress(PROGRESSIVE_CONTEXT* progressive,
                              UINT32 nWidth, UINT32 nHeight, UINT16 surfaceId)
 {
        INT32 rc = 1;
-       UINT status;
+       INT32 status;
        const BYTE* block;
        const BYTE* blocks;
        UINT16 i, j;
index 8abec18..5c97fee 100644 (file)
@@ -373,7 +373,7 @@ BYTE* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, UINT32 x, UINT32 y)
        BYTE* p;
        HGDI_BITMAP hBmp = (HGDI_BITMAP) hdcBmp->selectedObject;
 
-       if (x >= 0 && x < hBmp->width && y >= 0 && y < hBmp->height)
+       if (x < hBmp->width && y < hBmp->height)
        {
                p = hBmp->data + (y * hBmp->scanline) + (x * GetBytesPerPixel(hdcBmp->format));
                return p;
@@ -404,21 +404,17 @@ BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, UINT32 x, UINT32 y)
                    || (hdcBrush->brush->style == GDI_BS_HATCHED))
                {
                        HGDI_BITMAP hBmpBrush = hdcBrush->brush->pattern;
-
                        /* According to @msdn{dd183396}, the system always positions a brush bitmap
                         * at the brush origin and copy across the client area.
                         * Calculate the offset of the mapped pixel in the brush bitmap according to
                         * brush origin and dest coordinates */
-                       if (x >= 0 && y >= 0)
-                       {
-                               x = (x + hBmpBrush->width - (hdcBrush->brush->nXOrg % hBmpBrush->width)) %
-                                   hBmpBrush->width;
-                               y = (y + hBmpBrush->height - (hdcBrush->brush->nYOrg % hBmpBrush->height)) %
-                                   hBmpBrush->height;
-                               p = hBmpBrush->data + (y * hBmpBrush->scanline) + (x * GetBytesPerPixel(
-                                           hBmpBrush->format));
-                               return p;
-                       }
+                       x = (x + hBmpBrush->width - (hdcBrush->brush->nXOrg % hBmpBrush->width)) %
+                           hBmpBrush->width;
+                       y = (y + hBmpBrush->height - (hdcBrush->brush->nYOrg % hBmpBrush->height)) %
+                           hBmpBrush->height;
+                       p = hBmpBrush->data + (y * hBmpBrush->scanline) + (x * GetBytesPerPixel(
+                                   hBmpBrush->format));
+                       return p;
                }
        }
 
index 0907d1b..a2f19d4 100644 (file)
@@ -459,12 +459,6 @@ INLINE BOOL gdi_InvalidateRegion(HGDI_DC hdc, UINT32 x, UINT32 y, UINT32 w,
        gdi_CRgnToRect(x, y, w, h, &rgn);
        gdi_RgnToRect(invalid, &inv);
 
-       if (rgn.left < 0)
-               rgn.left = 0;
-
-       if (rgn.top < 0)
-               rgn.top = 0;
-
        if (rgn.left < inv.left)
                inv.left = rgn.left;
 
index ec2716f..187a380 100644 (file)
@@ -91,11 +91,11 @@ typedef struct _RPC_BINDING_VECTOR
 typedef struct _UUID_VECTOR
 {
        unsigned long Count;
-       UUID *Uuid[1];
+       UUIDUuid[1];
 } UUID_VECTOR;
 #define uuid_vector_t UUID_VECTOR
 
-typedef void *RPC_IF_HANDLE;
+typedef voidRPC_IF_HANDLE;
 
 typedef struct _RPC_IF_ID
 {
@@ -154,13 +154,13 @@ typedef struct _RPC_IF_ID
 typedef struct _RPC_PROTSEQ_VECTORA
 {
        unsigned int Count;
-       unsigned char *Protseq[1];
+       unsigned charProtseq[1];
 } RPC_PROTSEQ_VECTORA;
 
 typedef struct _RPC_PROTSEQ_VECTORW
 {
        unsigned int Count;
-       unsigned short *Protseq[1];
+       unsigned shortProtseq[1];
 } RPC_PROTSEQ_VECTORW;
 
 #ifdef UNICODE
@@ -176,8 +176,10 @@ typedef struct _RPC_POLICY
        unsigned long NICFlags;
 } RPC_POLICY, *PRPC_POLICY;
 
-typedef void RPC_OBJECT_INQ_FN(UUID* ObjectUuid, UUID* TypeUuid, RPC_STATUS* pStatus);
-typedef RPC_STATUS RPC_IF_CALLBACK_FN(RPC_IF_HANDLE InterfaceUuid, void* Context);
+typedef void RPC_OBJECT_INQ_FN(UUID* ObjectUuid, UUID* TypeUuid,
+                               RPC_STATUS* pStatus);
+typedef RPC_STATUS RPC_IF_CALLBACK_FN(RPC_IF_HANDLE InterfaceUuid,
+                                      void* Context);
 typedef void RPC_SECURITY_CALLBACK_FN(void* Context);
 
 #define RPC_MGR_EPV void
@@ -196,13 +198,13 @@ typedef struct
 typedef struct
 {
        unsigned long Count;
-       RPC_IF_ID *IfId[1];
+       RPC_IF_IDIfId[1];
 } RPC_IF_ID_VECTOR;
 
 #ifndef _WIN32
 
-typedef void *RPC_AUTH_IDENTITY_HANDLE;
-typedef void *RPC_AUTHZ_HANDLE;
+typedef voidRPC_AUTH_IDENTITY_HANDLE;
+typedef voidRPC_AUTHZ_HANDLE;
 
 #define RPC_C_AUTHN_LEVEL_DEFAULT                      0
 #define RPC_C_AUTHN_LEVEL_NONE                         1
@@ -308,7 +310,8 @@ typedef struct _RPC_SECURITY_QOS_V2_W
        unsigned long IdentityTracking;
        unsigned long ImpersonationType;
        unsigned long AdditionalSecurityInfoType;
-       union {
+       union
+       {
                RPC_HTTP_TRANSPORT_CREDENTIALS_W* HttpCredentials;
        } u;
 } RPC_SECURITY_QOS_V2_W, *PRPC_SECURITY_QOS_V2_W;
@@ -320,7 +323,8 @@ typedef struct _RPC_SECURITY_QOS_V2_A
        unsigned long IdentityTracking;
        unsigned long ImpersonationType;
        unsigned long AdditionalSecurityInfoType;
-       union {
+       union
+       {
                RPC_HTTP_TRANSPORT_CREDENTIALS_A* HttpCredentials;
        } u;
 } RPC_SECURITY_QOS_V2_A, *PRPC_SECURITY_QOS_V2_A;
@@ -334,7 +338,8 @@ typedef struct _RPC_SECURITY_QOS_V3_W
        unsigned long IdentityTracking;
        unsigned long ImpersonationType;
        unsigned long AdditionalSecurityInfoType;
-       union {
+       union
+       {
                RPC_HTTP_TRANSPORT_CREDENTIALS_W* HttpCredentials;
        } u;
        void* Sid;
@@ -347,7 +352,8 @@ typedef struct _RPC_SECURITY_QOS_V3_A
        unsigned long IdentityTracking;
        unsigned long ImpersonationType;
        unsigned long AdditionalSecurityInfoType;
-       union {
+       union
+       {
                RPC_HTTP_TRANSPORT_CREDENTIALS_A* HttpCredentials;
        } u;
        void* Sid;
@@ -362,11 +368,14 @@ typedef enum _RPC_HTTP_REDIRECTOR_STAGE
        RPCHTTP_RS_INTERFACE
 } RPC_HTTP_REDIRECTOR_STAGE;
 
-typedef RPC_STATUS (*RPC_NEW_HTTP_PROXY_CHANNEL)(RPC_HTTP_REDIRECTOR_STAGE RedirectorStage,
-               unsigned short* ServerName, unsigned short* ServerPort, unsigned short* RemoteUser,
-               unsigned short* AuthType, void* ResourceUuid, void* Metadata, void* SessionId,
-               void* Interface, void* Reserved, unsigned long Flags, unsigned short** NewServerName,
-               unsigned short** NewServerPort);
+typedef RPC_STATUS(*RPC_NEW_HTTP_PROXY_CHANNEL)(RPC_HTTP_REDIRECTOR_STAGE
+        RedirectorStage,
+        unsigned short* ServerName, unsigned short* ServerPort,
+        unsigned short* RemoteUser,
+        unsigned short* AuthType, void* ResourceUuid, void* Metadata, void* SessionId,
+        void* Interface, void* Reserved, unsigned long Flags,
+        unsigned short** NewServerName,
+        unsigned short** NewServerPort);
 
 typedef void (*RPC_HTTP_PROXY_FREE_STRING)(unsigned short* String);
 
@@ -377,11 +386,13 @@ typedef void (*RPC_HTTP_PROXY_FREE_STRING)(unsigned short* String);
 
 #endif
 
-typedef void (*RPC_AUTH_KEY_RETRIEVAL_FN)(void* Arg, unsigned short* ServerPrincName, unsigned long KeyVer, void** Key, RPC_STATUS* pStatus);
+typedef void (*RPC_AUTH_KEY_RETRIEVAL_FN)(void* Arg,
+        unsigned short* ServerPrincName, unsigned long KeyVer, void** Key,
+        RPC_STATUS* pStatus);
 
 #define DCE_C_ERROR_STRING_LEN                 256
 
-typedef I_RPC_HANDLE *RPC_EP_INQ_HANDLE;
+typedef I_RPC_HANDLERPC_EP_INQ_HANDLE;
 
 #define RPC_C_EP_ALL_ELTS                      0
 #define RPC_C_EP_MATCH_BY_IF                   1
@@ -394,7 +405,8 @@ typedef I_RPC_HANDLE *RPC_EP_INQ_HANDLE;
 #define RPC_C_VERS_MAJOR_ONLY                  4
 #define RPC_C_VERS_UPTO                                5
 
-typedef int (*RPC_MGMT_AUTHORIZATION_FN)(RPC_BINDING_HANDLE ClientBinding, unsigned long RequestedMgmtOperation, RPC_STATUS *pStatus);
+typedef int (*RPC_MGMT_AUTHORIZATION_FN)(RPC_BINDING_HANDLE ClientBinding,
+        unsigned long RequestedMgmtOperation, RPC_STATUS* pStatus);
 
 #define RPC_C_MGMT_INQ_IF_IDS                  0
 #define RPC_C_MGMT_INQ_PRINC_NAME              1
@@ -415,10 +427,10 @@ typedef int (*RPC_MGMT_AUTHORIZATION_FN)(RPC_BINDING_HANDLE ClientBinding, unsig
 
 typedef struct _RPC_BINDING_HANDLE_OPTIONS_V1
 {
-  unsigned long Version;
-  unsigned long Flags;
-  unsigned long ComTimeout;
-  unsigned long CallTimeout;
+       unsigned long Version;
+       unsigned long Flags;
+       unsigned long ComTimeout;
+       unsigned long CallTimeout;
 } RPC_BINDING_HANDLE_OPTIONS_V1, RPC_BINDING_HANDLE_OPTIONS;
 
 typedef struct
@@ -438,7 +450,8 @@ typedef struct _RPC_BINDING_HANDLE_TEMPLATE
        unsigned long ProtocolSequence;
        unsigned short* NetworkAddress;
        unsigned short* StringEndpoint;
-       union {
+       union
+       {
                unsigned short* Reserved;
        } u1;
        UUID ObjectUuid;
@@ -455,122 +468,205 @@ typedef struct _RPC_BINDING_HANDLE_TEMPLATE
 extern "C" {
 #endif
 
-WINPR_API RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE* DestinationBinding);
+WINPR_API RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding,
+                                    RPC_BINDING_HANDLE* DestinationBinding);
 WINPR_API RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE* Binding);
-WINPR_API RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR optionValue);
-WINPR_API RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR *pOptionValue);
-WINPR_API RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE* Binding);
-WINPR_API RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE* Binding);
-WINPR_API RPC_STATUS RpcSsGetContextBinding(void* ContextHandle, RPC_BINDING_HANDLE* Binding);
-WINPR_API RPC_STATUS RpcBindingInqObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
+WINPR_API RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding,
+        unsigned long option, ULONG_PTR optionValue);
+WINPR_API RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding,
+        unsigned long option, ULONG_PTR* pOptionValue);
+WINPR_API RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding,
+        RPC_BINDING_HANDLE* Binding);
+WINPR_API RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding,
+        RPC_BINDING_HANDLE* Binding);
+WINPR_API RPC_STATUS RpcSsGetContextBinding(void* ContextHandle,
+        RPC_BINDING_HANDLE* Binding);
+WINPR_API RPC_STATUS RpcBindingInqObject(RPC_BINDING_HANDLE Binding,
+        UUID* ObjectUuid);
 WINPR_API RPC_STATUS RpcBindingReset(RPC_BINDING_HANDLE Binding);
-WINPR_API RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
-WINPR_API RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc, unsigned long* AuthnLevel);
-WINPR_API RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR* StringBinding);
-WINPR_API RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding, RPC_WSTR* StringBinding);
+WINPR_API RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding,
+        UUID* ObjectUuid);
+WINPR_API RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc,
+        unsigned long* AuthnLevel);
+WINPR_API RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding,
+        RPC_CSTR* StringBinding);
+WINPR_API RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding,
+        RPC_WSTR* StringBinding);
 WINPR_API RPC_STATUS RpcBindingVectorFree(RPC_BINDING_VECTOR** BindingVector);
-WINPR_API RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr,
-               RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR* StringBinding);
-WINPR_API RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr,
-               RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR* StringBinding);
-WINPR_API RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR* ObjUuid, RPC_CSTR* Protseq,
-               RPC_CSTR* NetworkAddr, RPC_CSTR *Endpoint, RPC_CSTR* NetworkOptions);
-WINPR_API RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR* ObjUuid, RPC_WSTR* Protseq,
-               RPC_WSTR* NetworkAddr, RPC_WSTR *Endpoint, RPC_WSTR* NetworkOptions);
+WINPR_API RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid,
+        RPC_CSTR Protseq, RPC_CSTR NetworkAddr,
+        RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR* StringBinding);
+WINPR_API RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid,
+        RPC_WSTR Protseq, RPC_WSTR NetworkAddr,
+        RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR* StringBinding);
+WINPR_API RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding,
+        RPC_CSTR* ObjUuid, RPC_CSTR* Protseq,
+        RPC_CSTR* NetworkAddr, RPC_CSTR* Endpoint, RPC_CSTR* NetworkOptions);
+WINPR_API RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding,
+        RPC_WSTR* ObjUuid, RPC_WSTR* Protseq,
+        RPC_WSTR* NetworkAddr, RPC_WSTR* Endpoint, RPC_WSTR* NetworkOptions);
 WINPR_API RPC_STATUS RpcStringFreeA(RPC_CSTR* String);
 WINPR_API RPC_STATUS RpcStringFreeW(RPC_WSTR* String);
 WINPR_API RPC_STATUS RpcIfInqId(RPC_IF_HANDLE RpcIfHandle, RPC_IF_ID* RpcIfId);
 WINPR_API RPC_STATUS RpcNetworkIsProtseqValidA(RPC_CSTR Protseq);
 WINPR_API RPC_STATUS RpcNetworkIsProtseqValidW(RPC_WSTR Protseq);
-WINPR_API RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding, unsigned int* Timeout);
-WINPR_API RPC_STATUS RpcMgmtSetComTimeout(RPC_BINDING_HANDLE Binding, unsigned int Timeout);
+WINPR_API RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding,
+        unsigned int* Timeout);
+WINPR_API RPC_STATUS RpcMgmtSetComTimeout(RPC_BINDING_HANDLE Binding,
+        unsigned int Timeout);
 WINPR_API RPC_STATUS RpcMgmtSetCancelTimeout(long Timeout);
-WINPR_API RPC_STATUS RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA** ProtseqVector);
-WINPR_API RPC_STATUS RpcNetworkInqProtseqsW(RPC_PROTSEQ_VECTORW** ProtseqVector);
+WINPR_API RPC_STATUS RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA**
+        ProtseqVector);
+WINPR_API RPC_STATUS RpcNetworkInqProtseqsW(RPC_PROTSEQ_VECTORW**
+        ProtseqVector);
 WINPR_API RPC_STATUS RpcObjectInqType(UUID* ObjUuid, UUID* TypeUuid);
 WINPR_API RPC_STATUS RpcObjectSetInqFn(RPC_OBJECT_INQ_FN* InquiryFn);
 WINPR_API RPC_STATUS RpcObjectSetType(UUID* ObjUuid, UUID* TypeUuid);
 WINPR_API RPC_STATUS RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA** ProtseqVector);
 WINPR_API RPC_STATUS RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW** ProtseqVector);
-WINPR_API RPC_STATUS RpcServerInqBindings (RPC_BINDING_VECTOR** BindingVector);
-WINPR_API RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV** MgrEpv);
-WINPR_API RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads, unsigned int MaxCalls, unsigned int DontWait);
-WINPR_API RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv);
-WINPR_API RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
-               unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN* IfCallback);
-WINPR_API RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
-               unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn);
-WINPR_API RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, unsigned int WaitForCallsToComplete);
-WINPR_API RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, int RundownContextHandles);
-WINPR_API RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy);
-WINPR_API RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
-WINPR_API RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerInqBindings(RPC_BINDING_VECTOR** BindingVector);
+WINPR_API RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                                    RPC_MGR_EPV** MgrEpv);
+WINPR_API RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads,
+                                     unsigned int MaxCalls, unsigned int DontWait);
+WINPR_API RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec,
+        UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv);
+WINPR_API RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec,
+        UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
+        unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN* IfCallback);
+WINPR_API RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec,
+        UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
+        unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize,
+        RPC_IF_CALLBACK_FN* IfCallbackFn);
+WINPR_API RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec,
+        UUID* MgrTypeUuid, unsigned int WaitForCallsToComplete);
+WINPR_API RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec,
+        UUID* MgrTypeUuid, int RundownContextHandles);
+WINPR_API RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls,
+        void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls,
+        void* SecurityDescriptor, PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls,
+        RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls,
+        RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq,
+        unsigned int MaxCalls, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq,
+        unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq,
+        unsigned int MaxCalls, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq,
+        unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq,
+        unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq,
+        unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor,
+        PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq,
+        unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq,
+        unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor,
+        PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq,
+        unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq,
+        unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor,
+        PRPC_POLICY Policy);
+WINPR_API RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq,
+        unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
+WINPR_API RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq,
+        unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor,
+        PRPC_POLICY Policy);
 WINPR_API void RpcServerYield(void);
 WINPR_API RPC_STATUS RpcMgmtStatsVectorFree(RPC_STATS_VECTOR** StatsVector);
-WINPR_API RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR** Statistics);
+WINPR_API RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding,
+                                     RPC_STATS_VECTOR** Statistics);
 WINPR_API RPC_STATUS RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding);
 WINPR_API RPC_STATUS RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding);
 WINPR_API RPC_STATUS RpcMgmtWaitServerListen(void);
 WINPR_API RPC_STATUS RpcMgmtSetServerStackSize(unsigned long ThreadStackSize);
 WINPR_API void RpcSsDontSerializeContext(void);
 WINPR_API RPC_STATUS RpcMgmtEnableIdleCleanup(void);
-WINPR_API RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR** IfIdVector);
+WINPR_API RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding,
+                                     RPC_IF_ID_VECTOR** IfIdVector);
 WINPR_API RPC_STATUS RpcIfIdVectorFree(RPC_IF_ID_VECTOR** IfIdVector);
-WINPR_API RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_CSTR* ServerPrincName);
-WINPR_API RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_WSTR* ServerPrincName);
-WINPR_API RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc, RPC_CSTR* PrincName);
-WINPR_API RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc, RPC_WSTR* PrincName);
-WINPR_API RPC_STATUS RpcEpResolveBinding(RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec);
-WINPR_API RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_CSTR* EntryName);
-WINPR_API RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_WSTR* EntryName);
+WINPR_API RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding,
+        unsigned long AuthnSvc, RPC_CSTR* ServerPrincName);
+WINPR_API RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding,
+        unsigned long AuthnSvc, RPC_WSTR* ServerPrincName);
+WINPR_API RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc,
+        RPC_CSTR* PrincName);
+WINPR_API RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc,
+        RPC_WSTR* PrincName);
+WINPR_API RPC_STATUS RpcEpResolveBinding(RPC_BINDING_HANDLE Binding,
+        RPC_IF_HANDLE IfSpec);
+WINPR_API RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding,
+        unsigned long EntryNameSyntax, RPC_CSTR* EntryName);
+WINPR_API RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding,
+        unsigned long EntryNameSyntax, RPC_WSTR* EntryName);
 
 WINPR_API RPC_STATUS RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle);
 WINPR_API RPC_STATUS RpcRevertToSelfEx(RPC_BINDING_HANDLE BindingHandle);
 WINPR_API RPC_STATUS RpcRevertToSelf(void);
-WINPR_API RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-               RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc);
-WINPR_API RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-               RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc);
-WINPR_API RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-               RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc, unsigned long Flags);
-WINPR_API RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-               RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc, unsigned long Flags);
-WINPR_API RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
-               unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc);
-WINPR_API RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
-               unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc);
-WINPR_API RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
-               unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc);
-WINPR_API RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
-               unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQos);
-WINPR_API RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
-               unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc);
-WINPR_API RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
-               unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQOS);
-WINPR_API RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
-               unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
-               unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS);
-WINPR_API RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
-               unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
-               unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS);
-
-WINPR_API RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg);
-WINPR_API RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg);
-
-WINPR_API RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE* ServerBinding);
+WINPR_API RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding,
+        RPC_AUTHZ_HANDLE* Privs,
+        RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+        unsigned long* AuthzSvc);
+WINPR_API RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding,
+        RPC_AUTHZ_HANDLE* Privs,
+        RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+        unsigned long* AuthzSvc);
+WINPR_API RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE
+        ClientBinding, RPC_AUTHZ_HANDLE* Privs,
+        RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+        unsigned long* AuthzSvc, unsigned long Flags);
+WINPR_API RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE
+        ClientBinding, RPC_AUTHZ_HANDLE* Privs,
+        RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+        unsigned long* AuthzSvc, unsigned long Flags);
+WINPR_API RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding,
+        RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
+        unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+        unsigned long* AuthzSvc);
+WINPR_API RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding,
+        RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
+        unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+        unsigned long* AuthzSvc);
+WINPR_API RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding,
+        RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
+        unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+        unsigned long AuthzSvc);
+WINPR_API RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding,
+        RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
+        unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+        unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQos);
+WINPR_API RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding,
+        RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
+        unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+        unsigned long AuthzSvc);
+WINPR_API RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding,
+        RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
+        unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+        unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQOS);
+WINPR_API RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding,
+        RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
+        unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+        unsigned long* AuthzSvc,
+        unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS);
+WINPR_API RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding,
+        RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
+        unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+        unsigned long* AuthzSvc,
+        unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS);
+
+WINPR_API RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName,
+        unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg);
+WINPR_API RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName,
+        unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg);
+
+WINPR_API RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE
+        ClientBinding, RPC_BINDING_HANDLE* ServerBinding);
 WINPR_API DECLSPEC_NORETURN void RpcRaiseException(RPC_STATUS exception);
 WINPR_API RPC_STATUS RpcTestCancel(void);
 WINPR_API RPC_STATUS RpcServerTestCancel(RPC_BINDING_HANDLE BindingHandle);
@@ -579,35 +675,51 @@ WINPR_API RPC_STATUS RpcCancelThreadEx(void* Thread, long Timeout);
 
 WINPR_API RPC_STATUS UuidCreate(UUID* Uuid);
 WINPR_API RPC_STATUS UuidCreateSequential(UUID* Uuid);
-WINPR_API RPC_STATUS UuidToStringA(UUID* Uuid, RPC_CSTR* StringUuid);
+WINPR_API RPC_STATUS UuidToStringA(const UUID* Uuid, RPC_CSTR* StringUuid);
 WINPR_API RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID* Uuid);
-WINPR_API RPC_STATUS UuidToStringW(UUID* Uuid, RPC_WSTR* StringUuid);
+WINPR_API RPC_STATUS UuidToStringW(const UUID* Uuid, RPC_WSTR* StringUuid);
 WINPR_API RPC_STATUS UuidFromStringW(RPC_WSTR StringUuid, UUID* Uuid);
-WINPR_API signed int UuidCompare(UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status);
+WINPR_API signed int UuidCompare(const UUID* Uuid1, const UUID* Uuid2,
+                                 RPC_STATUS* Status);
 WINPR_API RPC_STATUS UuidCreateNil(UUID* NilUuid);
-WINPR_API int UuidEqual(UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status);
-WINPR_API unsigned short UuidHash(UUID* Uuid, RPC_STATUS* Status);
-WINPR_API int UuidIsNil(UUID* Uuid, RPC_STATUS* Status);
-
-WINPR_API RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation);
-WINPR_API RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation);
-WINPR_API RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation);
-WINPR_API RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation);
-WINPR_API RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector);
+WINPR_API int UuidEqual(const UUID* Uuid1, const UUID* Uuid2,
+                        RPC_STATUS* Status);
+WINPR_API unsigned short UuidHash(const UUID* Uuid, RPC_STATUS* Status);
+WINPR_API int UuidIsNil(const UUID* Uuid, RPC_STATUS* Status);
+
+WINPR_API RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec,
+        RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector,
+        RPC_CSTR Annotation);
+WINPR_API RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec,
+        RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector,
+        RPC_WSTR Annotation);
+WINPR_API RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec,
+                                    RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector,
+                                    RPC_CSTR Annotation);
+WINPR_API RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec,
+                                    RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector,
+                                    RPC_WSTR Annotation);
+WINPR_API RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec,
+                                     RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector);
 
 WINPR_API RPC_STATUS DceErrorInqTextA(RPC_STATUS RpcStatus, RPC_CSTR ErrorText);
 WINPR_API RPC_STATUS DceErrorInqTextW(RPC_STATUS RpcStatus, RPC_WSTR ErrorText);
 
-WINPR_API RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding, unsigned long InquiryType, RPC_IF_ID* IfId,
-               unsigned long VersOption, UUID* ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext);
+WINPR_API RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding,
+        unsigned long InquiryType, RPC_IF_ID* IfId,
+        unsigned long VersOption, UUID* ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext);
 WINPR_API RPC_STATUS RpcMgmtEpEltInqDone(RPC_EP_INQ_HANDLE* InquiryContext);
-WINPR_API RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
-               RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_CSTR* Annotation);
-WINPR_API RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
-               RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_WSTR* Annotation);
-WINPR_API RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding, RPC_IF_ID* IfId,
-               RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
-WINPR_API RPC_STATUS RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN AuthorizationFn);
+WINPR_API RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext,
+        RPC_IF_ID* IfId,
+        RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_CSTR* Annotation);
+WINPR_API RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext,
+        RPC_IF_ID* IfId,
+        RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_WSTR* Annotation);
+WINPR_API RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding,
+        RPC_IF_ID* IfId,
+        RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
+WINPR_API RPC_STATUS RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN
+        AuthorizationFn);
 
 WINPR_API RPC_STATUS RpcServerInqBindingHandle(RPC_BINDING_HANDLE* Binding);
 
index 03eaca2..8976f37 100644 (file)
@@ -30,7 +30,8 @@
 #include "../log.h"
 #define TAG WINPR_TAG("rpc")
 
-RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE* DestinationBinding)
+RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding,
+                          RPC_BINDING_HANDLE* DestinationBinding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -42,31 +43,36 @@ RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE* Binding)
        return 0;
 }
 
-RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR optionValue)
+RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding,
+                               unsigned long option, ULONG_PTR optionValue)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR* pOptionValue)
+RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding,
+                               unsigned long option, ULONG_PTR* pOptionValue)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE* Binding)
+RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding,
+                                        RPC_BINDING_HANDLE* Binding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE* Binding)
+RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding,
+                                        RPC_BINDING_HANDLE* Binding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcSsGetContextBinding(void* ContextHandle, RPC_BINDING_HANDLE* Binding)
+RPC_STATUS RpcSsGetContextBinding(void* ContextHandle,
+                                  RPC_BINDING_HANDLE* Binding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -90,19 +96,22 @@ RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid)
        return 0;
 }
 
-RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc, unsigned long* AuthnLevel)
+RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc,
+        unsigned long* AuthnLevel)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR* StringBinding)
+RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding,
+                                      RPC_CSTR* StringBinding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding, RPC_WSTR* StringBinding)
+RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding,
+                                      RPC_WSTR* StringBinding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -114,29 +123,33 @@ RPC_STATUS RpcBindingVectorFree(RPC_BINDING_VECTOR** BindingVector)
        return 0;
 }
 
-RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr,
-                                                                       RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR* StringBinding)
+RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq,
+                                    RPC_CSTR NetworkAddr,
+                                    RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR* StringBinding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr,
-                                                                       RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR* StringBinding)
+RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq,
+                                    RPC_WSTR NetworkAddr,
+                                    RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR* StringBinding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR* ObjUuid, RPC_CSTR* Protseq,
-                                                                 RPC_CSTR* NetworkAddr, RPC_CSTR* Endpoint, RPC_CSTR* NetworkOptions)
+RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR* ObjUuid,
+                                  RPC_CSTR* Protseq,
+                                  RPC_CSTR* NetworkAddr, RPC_CSTR* Endpoint, RPC_CSTR* NetworkOptions)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR* ObjUuid, RPC_WSTR* Protseq,
-                                                                 RPC_WSTR* NetworkAddr, RPC_WSTR* Endpoint, RPC_WSTR* NetworkOptions)
+RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR* ObjUuid,
+                                  RPC_WSTR* Protseq,
+                                  RPC_WSTR* NetworkAddr, RPC_WSTR* Endpoint, RPC_WSTR* NetworkOptions)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -176,13 +189,15 @@ RPC_STATUS RpcNetworkIsProtseqValidW(RPC_WSTR Protseq)
        return 0;
 }
 
-RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding, unsigned int* Timeout)
+RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding,
+                                unsigned int* Timeout)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcMgmtSetComTimeout(RPC_BINDING_HANDLE Binding, unsigned int Timeout)
+RPC_STATUS RpcMgmtSetComTimeout(RPC_BINDING_HANDLE Binding,
+                                unsigned int Timeout)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -242,141 +257,165 @@ RPC_STATUS RpcServerInqBindings(RPC_BINDING_VECTOR** BindingVector)
        return 0;
 }
 
-RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV** MgrEpv)
+RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                          RPC_MGR_EPV** MgrEpv)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads, unsigned int MaxCalls, unsigned int DontWait)
+RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads,
+                           unsigned int MaxCalls, unsigned int DontWait)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv)
+RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                               RPC_MGR_EPV* MgrEpv)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
-                                                                unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN* IfCallback)
+RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                                 RPC_MGR_EPV* MgrEpv,
+                                 unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN* IfCallback)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
-                                                               unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn)
+RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                                RPC_MGR_EPV* MgrEpv,
+                                unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize,
+                                RPC_IF_CALLBACK_FN* IfCallbackFn)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, unsigned int WaitForCallsToComplete)
+RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                                 unsigned int WaitForCallsToComplete)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, int RundownContextHandles)
+RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
+                                   int RundownContextHandles)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls,
+                                   void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls,
+                                     void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls,
+                                     RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls,
+                                       RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls,
+                                void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls,
+                                  void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls,
+                                void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls,
+                                  void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls,
+                                  RPC_CSTR Endpoint, void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls,
+                                    RPC_CSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls,
+                                  RPC_WSTR Endpoint, void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls,
+                                    RPC_WSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls,
+                                  RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls,
+                                    RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
+RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls,
+                                  RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
+RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls,
+                                    RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -393,7 +432,8 @@ RPC_STATUS RpcMgmtStatsVectorFree(RPC_STATS_VECTOR** StatsVector)
        return 0;
 }
 
-RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR** Statistics)
+RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding,
+                           RPC_STATS_VECTOR** Statistics)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -434,7 +474,8 @@ RPC_STATUS RpcMgmtEnableIdleCleanup(void)
        return 0;
 }
 
-RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR** IfIdVector)
+RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding,
+                           RPC_IF_ID_VECTOR** IfIdVector)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -446,25 +487,29 @@ RPC_STATUS RpcIfIdVectorFree(RPC_IF_ID_VECTOR** IfIdVector)
        return 0;
 }
 
-RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_CSTR* ServerPrincName)
+RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding,
+                                      unsigned long AuthnSvc, RPC_CSTR* ServerPrincName)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_WSTR* ServerPrincName)
+RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding,
+                                      unsigned long AuthnSvc, RPC_WSTR* ServerPrincName)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc, RPC_CSTR* PrincName)
+RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc,
+        RPC_CSTR* PrincName)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc, RPC_WSTR* PrincName)
+RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc,
+        RPC_WSTR* PrincName)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -476,13 +521,15 @@ RPC_STATUS RpcEpResolveBinding(RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec)
        return 0;
 }
 
-RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_CSTR* EntryName)
+RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding,
+                                     unsigned long EntryNameSyntax, RPC_CSTR* EntryName)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_WSTR* EntryName)
+RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding,
+                                     unsigned long EntryNameSyntax, RPC_WSTR* EntryName)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -507,107 +554,134 @@ RPC_STATUS RpcRevertToSelf()
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-                                                                       RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc)
+RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding,
+                                    RPC_AUTHZ_HANDLE* Privs,
+                                    RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+                                    unsigned long* AuthzSvc)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-                                                                       RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc)
+RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding,
+                                    RPC_AUTHZ_HANDLE* Privs,
+                                    RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+                                    unsigned long* AuthzSvc)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-                                                                         RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc, unsigned long Flags)
+RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding,
+                                      RPC_AUTHZ_HANDLE* Privs,
+                                      RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+                                      unsigned long* AuthzSvc, unsigned long Flags)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
-                                                                         RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc, unsigned long Flags)
+RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding,
+                                      RPC_AUTHZ_HANDLE* Privs,
+                                      RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc,
+                                      unsigned long* AuthzSvc, unsigned long Flags)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
-                                                                 unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc)
+RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding,
+                                  RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
+                                  unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+                                  unsigned long* AuthzSvc)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
-                                                                 unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc)
+RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding,
+                                  RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
+                                  unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+                                  unsigned long* AuthzSvc)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
-                                                                 unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc)
+RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding,
+                                  RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
+                                  unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+                                  unsigned long AuthzSvc)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
-                                                                       unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQos)
+RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding,
+                                    RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
+                                    unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+                                    unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQos)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
-                                                                 unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc)
+RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding,
+                                  RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
+                                  unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+                                  unsigned long AuthzSvc)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
-                                                                       unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQOS)
+RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding,
+                                    RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
+                                    unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+                                    unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQOS)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
-                                                                       unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
-                                                                       unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS)
+RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding,
+                                    RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
+                                    unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+                                    unsigned long* AuthzSvc,
+                                    unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
-                                                                       unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
-                                                                       unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS)
+RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding,
+                                    RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
+                                    unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
+                                    unsigned long* AuthzSvc,
+                                    unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
 
-RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
+RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName,
+                                      unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
+RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName,
+                                      unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
 
-RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE* ServerBinding)
+RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding,
+                                      RPC_BINDING_HANDLE* ServerBinding)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -665,7 +739,7 @@ RPC_STATUS UuidCreateSequential(UUID* Uuid)
        return RPC_S_OK;
 }
 
-RPC_STATUS UuidToStringA(UUID* Uuid, RPC_CSTR* StringUuid)
+RPC_STATUS UuidToStringA(const UUID* Uuid, RPC_CSTR* StringUuid)
 {
        *StringUuid = (RPC_CSTR) malloc(36 + 1);
 
@@ -679,15 +753,16 @@ RPC_STATUS UuidToStringA(UUID* Uuid, RPC_CSTR* StringUuid)
         * Format is 32 hex digits partitioned in 5 groups:
         * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
         */
-       sprintf_s((char*) *StringUuid, 36 + 1, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                         Uuid->Data1, Uuid->Data2, Uuid->Data3,
-                         Uuid->Data4[0], Uuid->Data4[1],
-                         Uuid->Data4[2], Uuid->Data4[3], Uuid->Data4[4],
-                         Uuid->Data4[5], Uuid->Data4[6], Uuid->Data4[7]);
+       sprintf_s((char*) *StringUuid, 36 + 1,
+                 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                 Uuid->Data1, Uuid->Data2, Uuid->Data3,
+                 Uuid->Data4[0], Uuid->Data4[1],
+                 Uuid->Data4[2], Uuid->Data4[3], Uuid->Data4[4],
+                 Uuid->Data4[5], Uuid->Data4[6], Uuid->Data4[7]);
        return RPC_S_OK;
 }
 
-RPC_STATUS UuidToStringW(UUID* Uuid, RPC_WSTR* StringUuid)
+RPC_STATUS UuidToStringW(const UUID* Uuid, RPC_WSTR* StringUuid)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -705,7 +780,7 @@ RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID* Uuid)
                return RPC_S_INVALID_STRING_UUID;
 
        if ((StringUuid[8] != '-') || (StringUuid[13] != '-') ||
-                       (StringUuid[18] != '-') || (StringUuid[23] != '-'))
+           (StringUuid[18] != '-') || (StringUuid[23] != '-'))
        {
                return RPC_S_INVALID_STRING_UUID;
        }
@@ -725,8 +800,9 @@ RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID* Uuid)
                        return RPC_S_INVALID_STRING_UUID;
        }
 
-       Uuid->Data1 = ((bin[0] << 28) | (bin[1] << 24) | (bin[2] << 20) | (bin[3] << 16) |
-                                  (bin[4] << 12) | (bin[5] << 8) | (bin[6] << 4) | bin[7]);
+       Uuid->Data1 = ((bin[0] << 28) | (bin[1] << 24) | (bin[2] << 20) |
+                      (bin[3] << 16) |
+                      (bin[4] << 12) | (bin[5] << 8) | (bin[6] << 4) | bin[7]);
        Uuid->Data2 = ((bin[9] << 12) | (bin[10] << 8) | (bin[11] << 4) | bin[12]);
        Uuid->Data3 = ((bin[14] << 12) | (bin[15] << 8) | (bin[16] << 4) | bin[17]);
        Uuid->Data4[0] = ((bin[19] << 4) | bin[20]);
@@ -746,7 +822,7 @@ RPC_STATUS UuidFromStringW(RPC_WSTR StringUuid, UUID* Uuid)
        return 0;
 }
 
-signed int UuidCompare(UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status)
+signed int UuidCompare(const UUID* Uuid1, const UUID* Uuid2, RPC_STATUS* Status)
 {
        int index;
        *Status = RPC_S_OK;
@@ -781,47 +857,52 @@ RPC_STATUS UuidCreateNil(UUID* NilUuid)
        return RPC_S_OK;
 }
 
-int UuidEqual(UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status)
+int UuidEqual(const UUID* Uuid1, const UUID* Uuid2, RPC_STATUS* Status)
 {
        return ((UuidCompare(Uuid1, Uuid2, Status) == 0) ? TRUE : FALSE);
 }
 
-unsigned short UuidHash(UUID* Uuid, RPC_STATUS* Status)
+unsigned short UuidHash(const UUID* Uuid, RPC_STATUS* Status)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-int UuidIsNil(UUID* Uuid, RPC_STATUS* Status)
+int UuidIsNil(const UUID* Uuid, RPC_STATUS* Status)
 {
        return UuidEqual(Uuid, &UUID_NIL, Status);
 }
 
-RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation)
+RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec,
+                                   RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation)
+RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec,
+                                   RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation)
+RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec,
+                          RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation)
+RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec,
+                          RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector)
+RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec,
+                           RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -841,8 +922,9 @@ RPC_STATUS DceErrorInqTextW(RPC_STATUS RpcStatus, RPC_WSTR ErrorText)
 }
 
 
-RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding, unsigned long InquiryType, RPC_IF_ID* IfId,
-                                                               unsigned long VersOption, UUID* ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
+RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding,
+                                unsigned long InquiryType, RPC_IF_ID* IfId,
+                                unsigned long VersOption, UUID* ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
@@ -854,22 +936,24 @@ RPC_STATUS RpcMgmtEpEltInqDone(RPC_EP_INQ_HANDLE* InquiryContext)
        return 0;
 }
 
-RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
-                                                               RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_CSTR* Annotation)
+RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext,
+                                RPC_IF_ID* IfId,
+                                RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_CSTR* Annotation)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
-RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
-                                                               RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_WSTR* Annotation)
+RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext,
+                                RPC_IF_ID* IfId,
+                                RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_WSTR* Annotation)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;
 }
 
 RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding, RPC_IF_ID* IfId,
-                                                          RPC_BINDING_HANDLE Binding, UUID* ObjectUuid)
+                               RPC_BINDING_HANDLE Binding, UUID* ObjectUuid)
 {
        WLog_ERR(TAG, "Not implemented");
        return 0;