Re: msdmo: Array parameter is passed to function as pointer so loses size information

2008-04-10 Thread Andrew Talbot
Robert Shearman wrote: > It doesn't matter what MSDN says about szName, RegQueryValueExW still > takes the size in bytes, not characters. I.e. count should be set to > NAME_SIZE * sizeof(WCHAR), not NAME_SIZE. > Hi Robert, Yes, indeed. I believe I may have had an editing accident with that one.

Re: msdmo: Array parameter is passed to function as pointer so loses size information

2008-04-10 Thread Robert Shearman
Andrew Talbot wrote: Robert Shearman wrote: This is incorrect. count is the size in bytes of the buffer passed in (szName) and so should be sizeof(szName) not sizeof(szName)/sizeof(szName[0]) (i.e. 80). Are you sure? MSDN says "szName: Array of 80 Unicode characters that receives the

Re: msdmo: Array parameter is passed to function as pointer so loses size information

2008-04-09 Thread Andrew Talbot
John Klehm wrote: If count needs to be the size of the buffer shouldn't it > be: > > count = NAME_SIZE * sizeof(WCHAR); > > but probably better would be DMO_MAX_NAME_SIZE and be in a header > somewhere (dmo.h?)? > > Regards, > John Ah yes, whoops. I'm pretty sure I had just that lined up, but

Re: msdmo: Array parameter is passed to function as pointer so loses size information

2008-04-09 Thread John Klehm
On Wed, Apr 9, 2008 at 11:54 AM, Andrew Talbot <[EMAIL PROTECTED]> wrote: > Robert Shearman wrote: > > This is incorrect. count is the size in bytes of the buffer passed in > > (szName) and so should be sizeof(szName) not > > sizeof(szName)/sizeof(szName[0]) (i.e. 80). > > > Andrew T is right a

Re: msdmo: Array parameter is passed to function as pointer so loses size information

2008-04-09 Thread Andrew Talbot
Robert Shearman wrote: > This is incorrect. count is the size in bytes of the buffer passed in > (szName) and so should be sizeof(szName) not > sizeof(szName)/sizeof(szName[0]) (i.e. 80). > Are you sure? MSDN says "szName: Array of 80 Unicode characters that receives the name of the DMO". > If y

Re: msdmo: Array parameter is passed to function as pointer so loses size information

2008-04-09 Thread Robert Shearman
Andrew Talbot wrote: > @@ -291,8 +291,9 @@ lend: > * > * Get DMP Name from the registry > */ > -HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR szName[80]) > +HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR szName[]) > { > +#define NAME_SIZE 80 /* Size of szName[] */ > WCHAR sz