Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-16 Thread Vitaliy Margolen
Sergey Khodych wrote:
>> No, there are 2 separate implementations - one ascii another unicode. During 
>> the object creation one would specify either ascii or unicode RIID.
> 
> Objects IDirectInputDevice8W and IDirectInputDevice8A has function
> GetProperty. This function get struct of type DIPROPSTRING as
> input/output parameter in our case . This struct has output field wsz of
> type WCHAR[ MAX_PATH ] and other input fields not depends of charset.
> So type of returned data will be WCHAR[ MAX_PATH ] in both case.
> So objects IDirectInputDevice8W and IDirectInputDevice8A has the same
> implementation of function GetProperty and this implementation is for
> Unicode in both case.
> 
> 
I'd like to see a test for this. So far I have not seen a case when ascii 
and unicode COM objects return the same exact unicode structure with unicode 
text. And we also seen number of cases when even SDK was wrong. Not even 
talking about MSDN.

Vitaliy




Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-16 Thread Sergey Khodych
> No, there are 2 separate implementations - one ascii another unicode. During 
> the object creation one would specify either ascii or unicode RIID.

Objects IDirectInputDevice8W and IDirectInputDevice8A has function
GetProperty. This function get struct of type DIPROPSTRING as
input/output parameter in our case . This struct has output field wsz of
type WCHAR[ MAX_PATH ] and other input fields not depends of charset.
So type of returned data will be WCHAR[ MAX_PATH ] in both case.
So objects IDirectInputDevice8W and IDirectInputDevice8A has the same
implementation of function GetProperty and this implementation is for
Unicode in both case.






Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-15 Thread Vitaliy Margolen
Sergey Khodych wrote:
>> In ascii function you are calling unicode function and copying it's output 
>> (unicode string) to the ascii string buffer. This is wrong. Also because 
>> these functions deal with strings you have to implement both ascii and 
>> unicode functions at the same time. You can't forward one to the other.
> Variable ps->wsz not a ascii string buffer because wsz field of struct
> DIPROPSTRING has type WCHAR[MAX_PATH]. Function
> IDirectInputDevice8::GetProperty works only with unicode strings.
> 
No, there are 2 separate implementations - one ascii another unicode. During 
the object creation one would specify either ascii or unicode RIID.

Vitaliy.




Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-15 Thread Sergey Khodych
> In ascii function you are calling unicode function and copying it's output 
> (unicode string) to the ascii string buffer. This is wrong. Also because 
> these functions deal with strings you have to implement both ascii and 
> unicode functions at the same time. You can't forward one to the other.
Variable ps->wsz not a ascii string buffer because wsz field of struct
DIPROPSTRING has type WCHAR[MAX_PATH]. Function
IDirectInputDevice8::GetProperty works only with unicode strings.








Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-14 Thread Vitaliy Margolen
Sergey Khodych wrote:
>>> ...
>>> +hr = SysKeyboardWImpl_GetObjectInfo( 
>>> (LPDIRECTINPUTDEVICE8W)iface , &didoi,
>>> + ps->diph.dwObj, 
>>> ps->diph.dwHow );
>> You mixing unicode and ascii. Also if you are implementing 
>> SysKeyboardAImpl_GetProperty you should also implement it's unicode 
>> counterpart SysKeyboardWImpl_GetProperty.
> Realization of GetProperty for keyboard device for unicode and ascii do
> not differ at this time.
> 

In ascii function you are calling unicode function and copying it's output 
(unicode string) to the ascii string buffer. This is wrong. Also because 
these functions deal with strings you have to implement both ascii and 
unicode functions at the same time. You can't forward one to the other.

Vitaliy.





Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-14 Thread Sergey Khodych
> 
>> ...
>> +hr = SysKeyboardWImpl_GetObjectInfo( 
>> (LPDIRECTINPUTDEVICE8W)iface , &didoi,
>> + ps->diph.dwObj, 
>> ps->diph.dwHow );
> 
> You mixing unicode and ascii. Also if you are implementing 
> SysKeyboardAImpl_GetProperty you should also implement it's unicode 
> counterpart SysKeyboardWImpl_GetProperty.
Realization of GetProperty for keyboard device for unicode and ascii do
not differ at this time.











Re: dinput: Implement DIPROP_KEYNAME property for keyboard device

2008-04-13 Thread Vitaliy Margolen
Sergey Khodych wrote:
> 
> 
> 
> 
> 

> +static HRESULT WINAPI SysKeyboardAImpl_GetProperty(
> ...
> +if (TRACE_ON(dinput))
> +_dump_DIPROPHEADER(pdiph);
Please drop the TRACE_ON check - it's being done in dump function.

> ...
> +hr = SysKeyboardWImpl_GetObjectInfo( 
> (LPDIRECTINPUTDEVICE8W)iface , &didoi,
> + ps->diph.dwObj, 
> ps->diph.dwHow );

You mixing unicode and ascii. Also if you are implementing 
SysKeyboardAImpl_GetProperty you should also implement it's unicode 
counterpart SysKeyboardWImpl_GetProperty.

And please use 4-space indent.

Vitaliy.