[Spice-devel] [PATCHv2 win-agent 2/9] mingw: use standard main() entry function

Christophe Fergeau cfergeau at redhat.com
Tue May 22 05:50:59 PDT 2012


On Wed, May 16, 2012 at 08:15:26PM +0200, Marc-André Lureau wrote:
> ---
>  vdagent/vdagent.cpp     |    4 ++++
>  vdservice/vdservice.cpp |    8 ++++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
> index 5cbe222..2722741 100644
> --- a/vdagent/vdagent.cpp
> +++ b/vdagent/vdagent.cpp
> @@ -1355,7 +1355,11 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
>      return 0;
>  }
>  
> +#ifdef __MINGW32__
> +int main(int argc,char **argv)
> +#else
>  int APIENTRY _tWinMain(HINSTANCE instance, HINSTANCE prev_instance, LPTSTR cmd_line, int cmd_show)
> +#endif
>  {
>      VDAgent* vdagent = VDAgent::get();
>      vdagent->run();
> diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
> index 4701f5a..48ebd7b 100644
> --- a/vdservice/vdservice.cpp
> +++ b/vdservice/vdservice.cpp
> @@ -1216,7 +1216,11 @@ void VDService::write_agent_control(uint32_t type, uint32_t opaque)
>      }
>  }
>  
> +#ifdef __MINGW32__
> +int main(int argc, char* argv[])
> +#else
>  int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
> +#endif
>  {
>      bool success = false;
>  
> @@ -1226,9 +1230,9 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
>      }
>      VDService* vdservice = VDService::get();
>      if (argc > 1) {
> -        if (lstrcmpi(argv[1], TEXT("install")) == 0) {
> +        if (strcmp(argv[1], "install") == 0) {

No clue if this compiles/does the right thing with VC++ once we define
UNICODE/_UNICODE, do you have any idea? mingw seems to have lstrcpmi in
winbase.h. We should keep the comparison case insensitive.

Christophe

>              success = vdservice->install();
> -        } else if (lstrcmpi(argv[1], TEXT("uninstall")) == 0) {
> +        } else if (strcmp(argv[1], "uninstall") == 0) {
>              success = vdservice->uninstall();
>          } else {
>              printf("Use: vdservice install / uninstall\n");
> -- 
> 1.7.10.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120522/a3e68f58/attachment-0001.pgp>


More information about the Spice-devel mailing list