Changeset 10048 for trunk/src


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

KSO: GetStartupInfo changes

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.CPP

    r9802 r10048  
    1 /* $Id: KERNEL32.CPP,v 1.74 2003-02-13 17:16:47 sandervl Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.75 2003-04-29 10:27:18 sandervl Exp $ */
    22
    33/*
     
    339339}
    340340//******************************************************************************
    341 //Borrowed from Wine
    342 //******************************************************************************
    343 void WIN32API GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
    344 {
    345   lpStartupInfo->cb               = sizeof(STARTUPINFOA);
    346   lpStartupInfo->lpReserved       = "<Reserved>";
    347   lpStartupInfo->lpDesktop        = "Desktop";
    348   lpStartupInfo->lpTitle          = "Title";
    349   lpStartupInfo->dwX              = 0;
    350   lpStartupInfo->dwY              = 0;
    351   lpStartupInfo->dwXSize          = 640;
    352   lpStartupInfo->dwYSize          = 480;
    353   lpStartupInfo->dwXCountChars    = 80;      // for console
    354   lpStartupInfo->dwYCountChars    = 25;
    355   lpStartupInfo->dwFillAttribute  = 0x0720;
    356   lpStartupInfo->dwFlags          = STARTF_USESHOWWINDOW   |
    357                                     STARTF_USEPOSITION     |
    358                                     STARTF_USESIZE         |
    359                                     STARTF_USECOUNTCHARS   |
    360                                     STARTF_USEFILLATTRIBUTE|
    361                                     STARTF_USESTDHANDLES;
    362   lpStartupInfo->wShowWindow      = SW_SHOWDEFAULT;
    363   lpStartupInfo->cbReserved2      = 0;
    364   lpStartupInfo->lpReserved2      = NULL; /* must be NULL for VC runtime */
    365   lpStartupInfo->hStdInput        = GetStdHandle(STD_INPUT_HANDLE);
    366   lpStartupInfo->hStdOutput       = GetStdHandle(STD_OUTPUT_HANDLE);
    367   lpStartupInfo->hStdError        = GetStdHandle(STD_ERROR_HANDLE);
    368   return;
    369 }
    370 //******************************************************************************
    371 //Borrowed from Wine
    372 //******************************************************************************
    373 void WIN32API GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
    374 {
    375   static WCHAR lpReserved[] = {'<', 'R','e','s','e','r','v','e','d','>', 0};
    376   static WCHAR lpDesktop[]  = {'D', 'e','s','k','t','o','p', 0};
    377   static WCHAR lpTitle[]    = {'T', 'i','t','l','e', 0};
    378 
    379   // forward call to ascii variant
    380   GetStartupInfoA((LPSTARTUPINFOA)lpStartupInfo);
    381   lpStartupInfo->cb          = sizeof(STARTUPINFOW);
    382   lpStartupInfo->lpReserved  = lpReserved;
    383   lpStartupInfo->lpDesktop   = lpDesktop;
    384   lpStartupInfo->lpTitle     = lpTitle;
    385   return;
    386 }
    387 //******************************************************************************
    388341//******************************************************************************
    389342BOOL WIN32API FlushInstructionCache(     /*PLF Mon  98-02-09 23:56:49 : STUB STUB STUB STUB STUB */
  • 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.