[PATCH] apphelp: Stubs for GetPermLayers and SetPermLayers.

Lauri Kenttä lauri.kentta at gmail.com
Mon Nov 28 12:12:57 CST 2016


Yes, I know this is wine-devel and not wine-patches. I'm just archiving
this here as a future reference, in case someone wants to implement
these functions later.

I did some small tests, see the example below. I also tested getting
the values after setting them manually through the "Compability" tab
of file properties. Wine has all kinds of compability options, so it
would be possible (in theory) to support these functions quite well.

My test program:

 #include <windows.h>
 #include <stdio.h>

BOOL WINAPI GetPermLayers(const WCHAR* wszPath, WCHAR* wszBuffer, DWORD* pdwBytes, DWORD dwFlags);
BOOL WINAPI SetPermLayers(const WCHAR* wszPath, const WCHAR* wszBuffer, BOOL bGlobal);

/* WCHAR helpers */
void wc(WCHAR* dest, const char* src) {
    while (*src) *dest++ = *src++;
    *dest++ = *src++;
}
void cw(char* dest, const WCHAR* src) {
    while (*src) *dest++ = *src++;
    *dest++ = *src++;
}
const char* c(const WCHAR* src) {
    static char buf[4][1024];
    static int i;
    char* dest = buf[i++ % 4];
    cw(dest, src);
    return dest;
}

int main() {
    WCHAR buf[64];
    WCHAR name[64];
    DWORD size;
    BOOL ret;

    wc(name, "C:\\a.exe");

    wc(buf, "640x480 lol fail");
    ret = SetPermLayers(name, buf, 0);
    printf("ret %x\n", ret);
    /* ret 1 */

    wc(buf, "DEADBEEF");
    size = 0;
    ret = GetPermLayers(name, buf, &size, 3);
    printf("ret %x, size %d, buf '%s'\n", ret, size, c(buf));
    /* ret 0, size 34, buf 'DEADBEEF' */

    wc(buf, "DEADBEEF");
    size = 2;
    ret = GetPermLayers(name, buf, &size, 3);
    printf("ret %x, size %d, buf '%s'\n", ret, size, c(buf));
    /* ret 0, size 34, buf 'DEADBEEF' */

    wc(buf, "DEADBEEF");
    size = sizeof(buf);
    ret = GetPermLayers(name, buf, &size, 3);
    printf("ret %x, size %d, buf '%s'\n", ret, size, c(buf));
    /* ret 1, size 34, buf '640x480 lol fail'; works just like 640X480, though */

    wc(buf, "640X480");
    ret = SetPermLayers(name, buf, 0);
    printf("ret %x\n", ret);
    /* ret 1 */

    wc(buf, "DEADBEEF");
    size = sizeof(buf);
    ret = GetPermLayers(name, buf, &size, 3);
    printf("ret %x, size %d, buf '%s'\n", ret, size, c(buf));
    /* ret 1, size 16, buf '640X480' */

    wc(buf, "");
    ret = SetPermLayers(name, buf, 0);
    printf("ret %x\n", ret);
    /* ret 1 */

    wc(buf, "DEADBEEF");
    size = sizeof(buf);
    ret = GetPermLayers(name, buf, &size, 3);
    printf("ret %x, size %d, buf '%s'\n", ret, size, c(buf));
    /* ret 0, size 0, buf 'DEADBEEF' */

    return 0;
}

Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
 dlls/apphelp/apphelp.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/apphelp/apphelp.c b/dlls/apphelp/apphelp.c
index 0ff74aa..7a09052 100644
--- a/dlls/apphelp/apphelp.c
+++ b/dlls/apphelp/apphelp.c
@@ -117,3 +117,23 @@ void WINAPI SdbGetAppPatchDir(HSDB hsdb, WCHAR *path, DWORD size)
     FIXME("stub: %p %p %d\n", hsdb, path, size);
     if (size && path) *path = 0;
 }
+
+BOOL WINAPI GetPermLayers(const WCHAR *path, WCHAR *buffer, DWORD *bytes, DWORD flags)
+{
+    /* Get the compability mode (Windows version, 640x480 etc.) of path.exe
+     *
+     * path = absolute(?) path to the executable
+     * buffer = where to put the result
+     * bytes = buffer size; if it's too small, set to required size and return FALSE.
+     * flags = local(1) | global(2).
+     */
+    FIXME("stub: %s %p %p %x\n", debugstr_w(path), buffer, bytes, flags);
+    return FALSE;
+}
+
+BOOL WINAPI SetPermLayers(const WCHAR *path, const WCHAR *buffer, BOOL global)
+{
+    /* Set the compability mode (Windows version, 640x480 etc.) for path.exe */
+    FIXME("stub: %s %s %x\n", debugstr_w(path), debugstr_w(buffer), global);
+    return FALSE;
+}
-- 
2.10.2




More information about the wine-devel mailing list