Hi Zebediah,

Thanks for the feedback.

Not sure how to quote in Gmail but I'll add > for each line I reply to.

>This debug channel is unused, and should generate a warning.

I can remove it but I plan on adding stub functions to the dll. CurrentIP is the first function the Microsoft Media Creation tool calls upon, ConstructPartialMsgVW after. Not sure how many others it will try to call. Based on your method, I think ConstructPartialMsgVW takes 3 arguments, but I checked it a few weeks ago so I don't remember if this is the exact number.

In any case, the debug channel would be used for those arguments. While we're on this subject, is there a method to determine the function return type, argument types and possibly names? I see DWORD and sometimes void is used for undocumented functions, would this be appropriate?

>No reason to make this a separate function; you can use
__ASM_STDCALL_FUNC() to declare it.

Thanks, is this correct so far?

__ASM_STDCALL_FUNC(CurrentIP, 0,
    "mov 0(%esp), %eax\n\t"
    "ret\n\t" )

>Please try to avoid whitespace errors.

I see a lot of files have a newline at the end, I'm assuming a newline avoids whitespace errors?

>Giovanni points out that this also won't compile on anything other than
i386. You'll need to use #ifdef guards to handle separate architectures.

I see, I'm not really sure what to do for the other architectures or which ones are appropriate in this context. I'm not familiar with arm assembly. I looked at the assembly code in kernelbase/thread.c for reference and this is what I have so far:

#ifdef __i386__
__ASM_STDCALL_FUNC(CurrentIP, 0,
    "movl 0(%esp), %eax\n\t"
    "ret" )
#elif defined(__x86_64__)
__ASM_STDCALL_FUNC(CurrentIP, 0,
    "movq 0(%rsp), %rax\n\t"
    "ret" )
#elif defined(__arm__)
__ASM_STDCALL_FUNC(CurrentIP, 0,
    "mov r13, r0\n\t"
    "ret" )
#elif defined(__aarch64__)
__ASM_STDCALL_FUNC(CurrentIP, 0,
    "mov sp, x0\n\t"
    "ret" )
#else
int WINAPI CurrentIP()
{
    FIXME( "not implemented\n" );
    return 0;
}
#endif

Is this a good start? What parts are incorrect?

On Wed, Jan 12, 2022 at 11:14 AM Zebediah Figura (she/her) <zfigura@codeweavers.com> wrote:
On 1/12/22 10:00, Zebediah Figura (she/her) wrote:
> Hello Mohammed, thanks for the patch! I have a few comments inlined below.
>
> On 1/12/22 05:03, Mohamad Al-Jaf wrote:
>> +#include <stdarg.h>
>> +#include <stdint.h>
>> +
>> +#include "windef.h"
>> +#include "winbase.h"
>> +
>> +#include "wine/asm.h"
>> +#include "wine/debug.h"
>> +
>> +WINE_DEFAULT_DEBUG_CHANNEL(wdscore);
>
> This debug channel is unused, and should generate a warning.
>
>> +
>> +uint32_t get_ip();
>> +__ASM_GLOBAL_FUNC( get_ip,
>> +    "mov 0(%esp), %eax\n\t"
>> +    "ret\n\t" )
>
> No reason to make this a separate function; you can use
> __ASM_STDCALL_FUNC() to declare it.

Giovanni points out that this also won't compile on anything other than
i386. You'll need to use #ifdef guards to handle separate architectures.

>
>> +
>> +
>> +/***********************************************************************
>> + *           CurrentIP (wdscore.@)
>> + */
>> +int WINAPI CurrentIP()
>> +{
>> +    uint32_t ip;
>> +
>> +    ip = get_ip();
>> +    return ip;
>> +}
>> \ No newline at end of file
>
> Please try to avoid whitespace errors.
>