Ignore:
Timestamp:
Apr 29, 2003, 12:27:18 PM (22 years ago)
Author:
sandervl
Message:

KSO: GetStartupInfo changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/wprocess.cpp

    r10012 r10048  
    1 /* $Id: wprocess.cpp,v 1.187 2003-04-11 14:21:53 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.188 2003-04-29 10:27:18 sandervl Exp $ */
    22
    33/*
     
    267267    InitializeCriticalSection(&ProcessENVDB.section);
    268268
    269 //         ProcessPDB.startup_info    = &StartupInfo;
    270269    ProcessPDB.unknown10       = (PVOID)&unknownPDBData[0];
     270
     271    //initialize the startup info part of the db entry.
     272////    O32_GetStartupInfo(&StartupInfo);
    271273    StartupInfo.cb             = sizeof(StartupInfo);
     274    /* Set some defaults as GetStartupInfo() used to set... */
     275    if (!(StartupInfo.dwFlags & STARTF_USESHOWWINDOW))
     276        StartupInfo.wShowWindow= SW_NORMAL;
     277    /* must be NULL for VC runtime */
     278    StartupInfo.lpReserved     = NULL;
     279    StartupInfo.cbReserved2     = NULL;
     280    if (!StartupInfo.lpDesktop)
     281        StartupInfo.lpDesktop  = "Desktop";
     282    if (!StartupInfo.lpTitle)
     283        StartupInfo.lpTitle    = "Title";
     284
    272285    ProcessENVDB.hStdin  = StartupInfo.hStdInput  = GetStdHandle(STD_INPUT_HANDLE);
    273286    ProcessENVDB.hStdout = StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
     
    22292242 HINSTANCE           hInstance;
    22302243
    2231     dprintf(("KERNEL32: WinExec %s\n", lpCmdLine));
    2232     startinfo.dwFlags = nCmdShow;
     2244    dprintf(("KERNEL32: WinExec lpCmdLine='%s' nCmdShow=%d\n", lpCmdLine));
     2245    startinfo.cb = sizeof(startinfo);
     2246    startinfo.dwFlags = STARTF_USESHOWWINDOW;
     2247    startinfo.wShowWindow = nCmdShow;
    22332248    if(CreateProcessA(NULL, (LPSTR)lpCmdLine, NULL, NULL, FALSE, 0, NULL, NULL,
    22342249                      &startinfo, &procinfo) == FALSE)
     
    25222537//******************************************************************************
    25232538//******************************************************************************
     2539
     2540
     2541/**
     2542 * Gets the startup info which was passed to CreateProcess when
     2543 * this process was created.
     2544 *
     2545 * @param   lpStartupInfo   Where to put the startup info.
     2546 *                          Please don't change the strings :)
     2547 * @status  Partially Implemented.
     2548 * @author  knut st. osmundsen <bird@anduin.net>
     2549 * @remark  The three pointers of the structure is just fake.
     2550 * @remark  Pretty much identical to current wine code.
     2551 */
     2552void WIN32API GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
     2553{
     2554    dprintf2(("KERNEL32: GetStartupInfoA %x\n", lpStartupInfo));
     2555    *lpStartupInfo = StartupInfo;
     2556}
     2557
     2558
     2559/**
     2560 * Gets the startup info which was passed to CreateProcess when
     2561 * this process was created.
     2562 *
     2563 * @param   lpStartupInfo   Where to put the startup info.
     2564 *                          Please don't change the strings :)
     2565 * @status  Partially Implemented.
     2566 * @author  knut st. osmundsen <bird@anduin.net>
     2567 * @remark  The three pointers of the structure is just fake.
     2568 * @remark  Similar to wine code, but they use RtlCreateUnicodeStringFromAsciiz
     2569 *          for creating the UNICODE strings and are doing so for each call.
     2570 *          As I don't wanna call NTDLL code from kernel32 I take the easy path.
     2571 */
     2572void WIN32API GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
     2573{
     2574    /*
     2575     * Converted once, this information shouldn't change...
     2576     */
     2577
     2578    dprintf2(("KERNEL32: GetStartupInfoW %x\n", lpStartupInfo));
     2579
     2580    //assumes the structs are identical but for the strings pointed to.
     2581    memcpy(lpStartupInfo, &StartupInfo, sizeof(STARTUPINFOA));
     2582    lpStartupInfo->cb = sizeof(STARTUPINFOW); /* this really should be the same size else we're in for trouble.. :) */
     2583
     2584    /*
     2585     * First time conversion only as this should be pretty static.
     2586     * See remark!
     2587     */
     2588    static LPWSTR pwcReserved = NULL;
     2589    static LPWSTR pwcDesktop = NULL;
     2590    static LPWSTR pwcTitle = NULL;
     2591
     2592    if (lpStartupInfo->lpReserved && pwcReserved)
     2593        pwcReserved = AsciiToUnicodeString((LPCSTR)lpStartupInfo->lpReserved);
     2594    lpStartupInfo->lpReserved = pwcReserved;
     2595
     2596    if (lpStartupInfo->lpDesktop && pwcDesktop)
     2597        pwcDesktop = AsciiToUnicodeString((LPCSTR)lpStartupInfo->lpDesktop);
     2598    lpStartupInfo->lpDesktop = pwcDesktop;
     2599
     2600    if (lpStartupInfo->lpTitle && pwcTitle)
     2601        pwcTitle = AsciiToUnicodeString((LPCSTR)lpStartupInfo->lpTitle);
     2602    lpStartupInfo->lpTitle = pwcTitle;
     2603}
     2604
Note: See TracChangeset for help on using the changeset viewer.