delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/08/12:50:41

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-WM-Posted-At: avacado.atomice.net; Sun, 8 Sep 02 17:25:04 +0100
From: "Chris January" <chris AT atomice DOT net>
To: "Cygwin AT Cygwin DOT Com" <cygwin AT cygwin DOT com>
Subject: Problem using Unicode Windows API with g++
Date: Sun, 8 Sep 2002 17:25:00 +0100
Message-ID: <LPEHIHGCJOAIPFLADJAHIEBJCMAA.chris@atomice.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019