James Hawkins wrote:
WCHAR is a wide (unicode) character. sizeof(embedding)/sizeof(WCHAR) will return the length of the strength in characters and not the size of it if I'm not mistaken.
Yes, and I think you will want to have the length in characters when declaring a (C) array in the example code below:
With
static const WCHAR embedding[] = { ' ', '-','E','m','b','e','d','d','i','n','g',0 };
You will want
WCHAR command[MAX_PATH+(sizeof(embedding)/sizeof(WCHAR)+1];
instead of
WCHAR command[MAX_PATH+sizeof(embedding)+1];
Because if sizeof(WCHAR) == 2, then command will be strlen(embedding) to large.
On Mon, 26 Jul 2004 18:24:48 +0200, Jeroen Janssen japj@xs4all.nl wrote:
Mike Hearn wrote:
ChangeLog: Pass -Embedding switch to EXE servers, more tracing
diff -u -p -r1.15 rpc.c --- dlls/ole32/rpc.c 15 Jul 2004 22:07:44 -0000 1.15 +++ dlls/ole32/rpc.c 21 Jul 2004 22:43:59 -0000 @@ -471,8 +471,10 @@ create_server(REFCLSID rclsid) { char buf[200]; HRESULT hres = E_UNEXPECTED; char xclsid[80];
- WCHAR dllName[MAX_PATH+1];
- DWORD dllNameLen = sizeof(dllName);
- WCHAR exe[MAX_PATH+1];
- DWORD exelen = sizeof(exe);
- static const WCHAR embedding[] = { ' ', '-','E','m','b','e','d','d','i','n','g',0 };
- WCHAR command[MAX_PATH+sizeof(embedding)+1];
On a side note, what exactly is a WCHAR? Is it a 'char' or a 'unicode char' (2bytes)?
This in relation to sizeof(embedding) instead of sizeof(embedding)/sizeof(WCHAR)?
Jeroen
On Mon, 26 Jul 2004 19:38:34 +0200, Jeroen Janssen wrote:
Yes, and I think you will want to have the length in characters when declaring a (C) array in the example code below:
Oops yes you are right (again), I was slipping back into the old delphi habits where sizeof() on an array returns the number of elements ...
Mike Hearn wrote:
On Mon, 26 Jul 2004 19:38:34 +0200, Jeroen Janssen wrote:
Yes, and I think you will want to have the length in characters when declaring a (C) array in the example code below:
Oops yes you are right (again), I was slipping back into the old delphi habits where sizeof() on an array returns the number of elements ...
Ah, well stuff like this happen to me also in a while :)
Besides, I just saw that when Alexandre comitted your patch, he already fixed this. See also http://cvs.winehq.org/patch.py?id=13055
I'm now just wondering if there is no +1 missing for the command string... --- Jeroen