This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problem using Unicode Windows API with g++


When I compile and run the program below with g++ version 2 or 3 under
Cygwin it crashes. It makes no difference whether I use the -mno-cygwin
parameter or not. The same program using the ANSI APIs doesn't crash. What
am I doing wrong?

Chris

---

#define UNICODE

#include <windows.h>
#include <stdio.h>

BOOL LogonAndRun (WCHAR * appname,
                  WCHAR * UserName,
                  WCHAR * Domain,
                  WCHAR * Password);

int
main (int argc,
      char *argv[])
{
	LogonAndRun (L"cmd.exe", L"", L"",
                 L"");
}

BOOL
LogonAndRun (WCHAR * appname,
             WCHAR * UserName,
             WCHAR * Domain,
             WCHAR * Password)
{
        STARTUPINFO sui;
        PROCESS_INFORMATION pi;
	ZeroMemory ((PVOID) & sui, sizeof (sui));
        sui.cb = sizeof (sui);
        sui.dwFlags = 0;
    BOOL c = CreateProcessW (NULL,
                      appname,
                      NULL,
                      NULL,
                      1,
                      0,
                      NULL,
                      NULL,
                      &sui,
                      &pi);
        return 1;
}


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]