Hi everybody! I'm new to this list.
I found this page (in deutsch) which seems to document an otherwise undocumented function, namely GetPermLayers from aphelp.dll.
I don't know where they got it, but seems a realistic definition.
Hope it helps. And thanks for your development effort, go on this way! :D
P.S. It' in delphi, there's a "var" keyword, which should means (from google, I'm not a delphist) an optional argument. IDA PRO gives error when given the last two args. Hope you can figure out where's the problem
Sorry, the link didn't copy, here it is: http://www.delphipraxis.net/845969-post3.html
Il giorno ven 25 nov 2016 alle ore 23:17 Marco Savelli svlmrc@gmail.com ha scritto:
Hi everybody! I'm new to this list.
I found this page (in deutsch) which seems to document an otherwise undocumented function, namely GetPermLayers from aphelp.dll.
I don't know where they got it, but seems a realistic definition.
Hope it helps. And thanks for your development effort, go on this way! :D
P.S. It' in delphi, there's a "var" keyword, which should means (from google, I'm not a delphist) an optional argument. IDA PRO gives error when given the last two args. Hope you can figure out where's the problem
On 26.11.2016 1:17, Marco Savelli wrote:
Hi everybody! I'm new to this list.
I found this page (in deutsch) which seems to document an otherwise undocumented function, namely GetPermLayers from aphelp.dll.
I don't know where they got it, but seems a realistic definition.
Hope it helps. And thanks for your development effort, go on this way! :D
P.S. It' in delphi, there's a "var" keyword, which should means (from google, I'm not a delphist) an optional argument. IDA PRO gives error when given the last two args. Hope you can figure out where's the problem
'Var' means that argument is passed by reference rather than by value. Anyway, if function is undocumented it's unlikely that many applications will be using it.
Of course, but as you can see someone stubbed it. Maybe it's just of academic interest, after all
Il giorno ven 25 nov 2016 alle ore 23:34 Nikolay Sivov bunglehead@gmail.com ha scritto:
On 26.11.2016 1:17, Marco Savelli wrote:
Hi everybody! I'm new to this list.
I found this page (in deutsch) which seems to document an otherwise undocumented function, namely GetPermLayers from aphelp.dll.
I don't know where they got it, but seems a realistic definition.
Hope it helps. And thanks for your development effort, go on this way! :D
P.S. It' in delphi, there's a "var" keyword, which should means (from google, I'm not a delphist) an optional argument. IDA PRO gives error when given the last two args. Hope you can figure out where's the problem
'Var' means that argument is passed by reference rather than by value. Anyway, if function is undocumented it's unlikely that many applications will be using it.
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@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; +}