Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This information is from the comments:</p> <pre><code>typedef void (WINAPI LPSERVICE_MAIN_FUNCTIONA)(DWORD,LPSTR); typedef void (WINAPI LPSERVICE_MAIN_FUNCTIONW)(DWORD,LPWSTR); typedef LPSERVICE_MAIN_FUNCTIONA LPSERVICE_MAIN_FUNCTION; typedef LPSERVICE_MAIN_FUNCTIONW LPSERVICE_MAIN_FUNCTION; </code></pre> <p>(Presumably only one of the latter two typedefs will be active.)</p> <p><code>LPSERVICE_MAIN_FUNCTION</code> is a typedef for a function returning <code>void</code> and taking two arguments of types <code>DWORD</code> and <code>LPSTR</code> or <code>LPWSTR</code>. Your <code>ServiceMain</code> function returns <code>void</code> and takes <em>three</em> arguments of types <code>int</code>, <code>char**</code>, and <code>char**</code>.</p> <p>Change the definition of <code>ServiceMain</code> function so it's compatible with <code>LPSERVICE_MAIN_FUNCTION</code>.</p> <p>Casting <code>ServiceMain</code> to <code>LPSERVICE_MAIN_FUNCTION</code> will silence the compiler warning, but it <em>doesn't</em> solve the problem. It will cause your function to be called <em>as if</em> it were declared correctly, with unpredictable results (undefined behavior). All casts should be viewed with suspicion; if your compiler is warning you about a type mismatch, the best solution is usually to change your declarations so the types match, not to force the compiler to pretend that they're ok.</p> <p>(Is there a typedef that's either <code>LPSTR</code> or <code>LPWSTR</code>, depending on the configuration?)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload