<div dir="ltr">>

Adding the debug channel declaration should be deferred until the first<br>> patch that uses it.<div><br></div><div>I was going to remove it but since the #ifdef guards ends with an unknown architecture, it would require the debug channel to display the fixme message, no?<br><br>> I am sort of led to wonder, though, is there really a point in trying to<br>> use this program with builtin wdscore? It sounds like the DLL is rather<br>> private to the program in question. As long as you're copying the Media<br>> Creation tool from a windows 10 installation (since I don't see any<br>> other way to acquire it?) I'd imagine that one should copy native<br>> wdscore.dll as well.</div><div><br></div><div>You can download the tool directly from Microsoft.com and also the archive link in the wine bug report. But you're right, there's no real point to using the builtin wdscore. Personally, I'd use the native dll for something like this. I figured since it was already in the wine tree and the bug report was accepted, it would be a good learning exercise.</div><div><br></div><div>> No, you pretty much have to guess just from figuring out what the</div>> arguments look like. If you can't tell I'd recommend using "void *" or<br>> "DWORD_PTR" so that the entire value is captured.<div><br></div><div>I see, thank you.</div><div><br></div><div>>Yes, that looks correct. Note that you don't need the \n\t after the</div>> last instruction.<div><br></div><div>Thanks, I figured as much and removed the \n\t afterwards.</div><div><br></div><div>> A missing newline at the end of a file is considered a whitespace error;</div>> I believe Git should warn you about those.<div><br></div><div>That's odd, I don't think it warned me. Perhaps I need to configure it for that?<br></div><div><br></div><div>> I'm not an expert in ARM assembly, but I believe you want:<br>><br>>     mov lr, r0<br>>     bx lr<br>><br>> for ARM, and<br>><br>>     mov lr, x0<br>>     ret<br>><br>> for ARM64.<br>><br>> The rest looks correct to me.<br></div><div><br></div><div>Thank you so much, I really appreciate all the help you've given me. You're a great teacher!</div><div><br></div><div>> Is there any indication this function should be doing something like</div>> this at all?<div><br></div><div>I'm testing it out in Windows to get a sense of what it does. Here's my code in C++, let me know if it's incorrect:</div><div><br></div><div>    typedef int (*CurrentIP)();<br>    HMODULE hDLL = LoadLibraryA("wdscore.dll");<br>    CurrentIP ip = (CurrentIP)GetProcAddress(hDLL, "CurrentIP");<br>    std::cout << "CurrentIP() = " << ip() << "\n";<br>    FreeLibrary(hDLL);<br></div><div><br></div><div>It returns random numbers, e.g. 10424371, 1249331, 6033459. So doesn't this mean it's returning the instruction pointer?</div><div><br></div><div>If so, I don't know how to write a conformance test for it. Would it be necessary in this case?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 13, 2022 at 11:20 PM Nikolay Sivov <<a href="mailto:nsivov@codeweavers.com">nsivov@codeweavers.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 1/14/22 02:23, Zebediah Figura (she/her) wrote:<br>
> On 1/12/22 20:25, Mohamad Al-Jaf wrote:<br>
>> Hi Zebediah,<br>
>><br>
>> Thanks for the feedback.<br>
>><br>
>> Not sure how to quote in Gmail but I'll add > for each line I reply to.<br>
>><br>
>>> This debug channel is unused, and should generate a warning.<br>
>><br>
>> I can remove it but I plan on adding stub functions to the dll. <br>
>> CurrentIP<br>
>> is the first function the Microsoft Media Creation tool calls upon,<br>
>> ConstructPartialMsgVW after. Not sure how many others it will try to <br>
>> call.<br>
>> Based on your method, I think ConstructPartialMsgVW takes 3 <br>
>> arguments, but<br>
>> I checked it a few weeks ago so I don't remember if this is the exact<br>
>> number.<br>
><br>
> Adding the debug channel declaration should be deferred until the <br>
> first patch that uses it.<br>
><br>
> I am sort of led to wonder, though, is there really a point in trying <br>
> to use this program with builtin wdscore? It sounds like the DLL is <br>
> rather private to the program in question. As long as you're copying <br>
> the Media Creation tool from a windows 10 installation (since I don't <br>
> see any other way to acquire it?) I'd imagine that one should copy <br>
> native wdscore.dll as well.<br>
><br>
>><br>
>> In any case, the debug channel would be used for those arguments. While<br>
>> we're on this subject, is there a method to determine the function <br>
>> return<br>
>> type, argument types and possibly names? I see DWORD and sometimes <br>
>> void is<br>
>> used for undocumented functions, would this be appropriate?<br>
><br>
> No, you pretty much have to guess just from figuring out what the <br>
> arguments look like. If you can't tell I'd recommend using "void *" or <br>
> "DWORD_PTR" so that the entire value is captured.<br>
><br>
>><br>
>>> No reason to make this a separate function; you can use<br>
>> __ASM_STDCALL_FUNC() to declare it.<br>
>><br>
>> Thanks, is this correct so far?<br>
>><br>
>> __ASM_STDCALL_FUNC(CurrentIP, 0,<br>
>>      "mov 0(%esp), %eax\n\t"<br>
>>      "ret\n\t" )<br>
><br>
> Yes, that looks correct. Note that you don't need the \n\t after the <br>
> last instruction.<br>
><br>
>><br>
>>> Please try to avoid whitespace errors.<br>
>><br>
>> I see a lot of files have a newline at the end, I'm assuming a newline<br>
>> avoids whitespace errors?<br>
><br>
> A missing newline at the end of a file is considered a whitespace <br>
> error; I believe Git should warn you about those.<br>
><br>
>><br>
>>> Giovanni points out that this also won't compile on anything other than<br>
>> i386. You'll need to use #ifdef guards to handle separate architectures.<br>
>><br>
>> I see, I'm not really sure what to do for the other architectures or <br>
>> which<br>
>> ones are appropriate in this context. I'm not familiar with arm <br>
>> assembly. I<br>
>> looked at the assembly code in kernelbase/thread.c for reference and <br>
>> this<br>
>> is what I have so far:<br>
>><br>
>> #ifdef __i386__<br>
>> __ASM_STDCALL_FUNC(CurrentIP, 0,<br>
>>      "movl 0(%esp), %eax\n\t"<br>
>>      "ret" )<br>
>> #elif defined(__x86_64__)<br>
>> __ASM_STDCALL_FUNC(CurrentIP, 0,<br>
>>      "movq 0(%rsp), %rax\n\t"<br>
>>      "ret" )<br>
>> #elif defined(__arm__)<br>
>> __ASM_STDCALL_FUNC(CurrentIP, 0,<br>
>>      "mov r13, r0\n\t"<br>
>>      "ret" )<br>
>> #elif defined(__aarch64__)<br>
>> __ASM_STDCALL_FUNC(CurrentIP, 0,<br>
>>      "mov sp, x0\n\t"<br>
>>      "ret" )<br>
>> #else<br>
>> int WINAPI CurrentIP()<br>
>> {<br>
>>      FIXME( "not implemented\n" );<br>
>>      return 0;<br>
>> }<br>
>> #endif<br>
>><br>
>> Is this a good start? What parts are incorrect?<br>
><br>
> I'm not an expert in ARM assembly, but I believe you want:<br>
><br>
>     mov lr, r0<br>
>     bx lr<br>
><br>
> for ARM, and<br>
><br>
>     mov lr, x0<br>
>     ret<br>
><br>
> for ARM64.<br>
><br>
> The rest looks correct to me.<br>
><br>
Is there any indication this function should be doing something like <br>
this at all?<br>
<br>
</blockquote></div>