Changeset 31 for trunk/src/helpers/winh.c
- Timestamp:
- Jan 30, 2001, 7:42:31 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/winh.c
r26 r31 2404 2404 const char *pcszWindowTitle) // in: help window title or NULL 2405 2405 { 2406 PPIB ppib;2407 PTIB ptib;2408 2406 HELPINIT hi; 2409 2407 PSZ pszExt; 2410 CHAR szName[ CCHMAXPATH];2408 CHAR szName[CCHMAXPATH]; 2411 2409 HWND hwndHelp; 2412 2410 2413 if ( (pcszFileName == NULL)2414 // || (*pszFileName)2415 )2416 {2411 if (pcszFileName == NULL) 2412 { 2413 PPIB ppib; 2414 PTIB ptib; 2417 2415 DosGetInfoBlocks(&ptib, &ppib); 2418 2419 2416 DosQueryModuleName(ppib->pib_hmte, sizeof(szName), szName); 2420 2417 … … 2451 2448 2452 2449 /* 2450 *@@ winhDisplayHelpPanel: 2451 * displays the specified help panel ID. 2452 * 2453 * If (ulHelpPanel == 0), this displays the 2454 * standard OS/2 "Using help" panel. 2455 * 2456 * Returns zero on success or one of the 2457 * help manager error codes on failure. 2458 * See HM_ERROR for those. 2459 * 2460 *@@added V0.9.7 (2001-01-21) [umoeller] 2461 */ 2462 2463 ULONG winhDisplayHelpPanel(HWND hwndHelpInstance, // in: from winhCreateHelp 2464 ULONG ulHelpPanel) // in: help panel ID 2465 { 2466 return (ULONG)(WinSendMsg(hwndHelpInstance, 2467 HM_DISPLAY_HELP, 2468 (MPARAM)ulHelpPanel, 2469 (MPARAM)( (ulHelpPanel != 0) 2470 ? HM_RESOURCEID 2471 : 0))); 2472 } 2473 2474 /* 2453 2475 *@@ winhDestroyHelp: 2454 2476 * destroys the help instance created by winhCreateHelp. … … 2571 2593 *@@changed V0.9.7 (2000-12-10) [umoeller]: PROGDETAILS.swpInitial no longer zeroed... this broke VIOs 2572 2594 *@@changed V0.9.7 (2000-12-17) [umoeller]: PROGDETAILS.pszEnvironment no longer zeroed 2595 *@@changed V0.9.9 (2001-01-27) [umoeller]: crashed if PROGDETAILS.pszExecutable was NULL 2573 2596 */ 2574 2597 … … 2589 2612 // ProgDetails.pszEnvironment = 0; 2590 2613 2591 // memset(&ProgDetails.swpInitial, 0, sizeof(SWP)); 2592 // this wasn't a good idea... WPProgram stores stuff 2593 // in here, such as the "minimize on startup" -> SWP_MINIMIZE 2594 2595 // duplicate parameters... 2596 // we need this for string manipulations below... 2597 if (ProgDetails.pszParameters) 2598 xstrInitCopy(&strParamsPatched, 2599 ProgDetails.pszParameters, 2600 100); 2601 else 2602 // no old params: 2603 xstrInit(&strParamsPatched, 100); 2604 2605 // _Pmpf((__FUNCTION__ ": old progc: 0x%lX", pcProgDetails->progt.progc)); 2606 // _Pmpf((" pszTitle: %s", (ProgDetails.pszTitle) ? ProgDetails.pszTitle : NULL)); 2607 // _Pmpf((" pszIcon: %s", (ProgDetails.pszIcon) ? ProgDetails.pszIcon : NULL)); 2608 2609 // program type fixups 2610 switch (ProgDetails.progt.progc) // that's a ULONG 2611 { 2612 case ((ULONG)-1): // we get that sometimes... 2613 case PROG_DEFAULT: 2614 // ### 2615 break; 2616 } 2617 2618 // now try again... 2619 switch (ProgDetails.progt.progc) 2620 { 2621 case PROG_31_ENHSEAMLESSVDM: // 17 2622 case PROG_31_ENHSEAMLESSCOMMON: // 18 2623 case PROG_31_ENH: // 19 2624 fIsWindowsApp = TRUE; 2625 fIsWindowsEnhApp = TRUE; 2626 break; 2627 2628 #ifndef PROG_30_STD 2629 #define PROG_30_STD (PROGCATEGORY)11 2630 #endif 2631 2632 #ifndef PROG_30_STDSEAMLESSVDM 2633 #define PROG_30_STDSEAMLESSVDM (PROGCATEGORY)13 2634 #endif 2635 2636 case PROG_WINDOW_REAL: // 10 2637 case PROG_30_STD: // 11 2638 case PROG_WINDOW_AUTO: // 12 2639 case PROG_30_STDSEAMLESSVDM: // 13 2640 case PROG_30_STDSEAMLESSCOMMON: // 14 2641 case PROG_31_STDSEAMLESSVDM: // 15 2642 case PROG_31_STDSEAMLESSCOMMON: // 16 2643 case PROG_31_STD: // 20 2644 fIsWindowsApp = TRUE; 2645 break; 2646 } 2647 2648 /* 2649 * command lines fixups: 2650 * 2651 */ 2652 2653 if (strcmp(ProgDetails.pszExecutable, "*") == 0) 2654 { 2614 // all this only makes sense if this contains something... 2615 // besides, this crashed on string comparisons V0.9.9 (2001-01-27) [umoeller] 2616 if (ProgDetails.pszExecutable) 2617 { 2618 // memset(&ProgDetails.swpInitial, 0, sizeof(SWP)); 2619 // this wasn't a good idea... WPProgram stores stuff 2620 // in here, such as the "minimize on startup" -> SWP_MINIMIZE 2621 2622 // duplicate parameters... 2623 // we need this for string manipulations below... 2624 if (ProgDetails.pszParameters) 2625 xstrInitCopy(&strParamsPatched, 2626 ProgDetails.pszParameters, 2627 100); 2628 else 2629 // no old params: 2630 xstrInit(&strParamsPatched, 100); 2631 2632 // _Pmpf((__FUNCTION__ ": old progc: 0x%lX", pcProgDetails->progt.progc)); 2633 // _Pmpf((" pszTitle: %s", (ProgDetails.pszTitle) ? ProgDetails.pszTitle : NULL)); 2634 // _Pmpf((" pszIcon: %s", (ProgDetails.pszIcon) ? ProgDetails.pszIcon : NULL)); 2635 2636 // program type fixups 2637 switch (ProgDetails.progt.progc) // that's a ULONG 2638 { 2639 case ((ULONG)-1): // we get that sometimes... 2640 case PROG_DEFAULT: 2641 // ### 2642 break; 2643 } 2644 2645 // now try again... 2646 switch (ProgDetails.progt.progc) 2647 { 2648 case PROG_31_ENHSEAMLESSVDM: // 17 2649 case PROG_31_ENHSEAMLESSCOMMON: // 18 2650 case PROG_31_ENH: // 19 2651 fIsWindowsApp = TRUE; 2652 fIsWindowsEnhApp = TRUE; 2653 break; 2654 2655 #ifndef PROG_30_STD 2656 #define PROG_30_STD (PROGCATEGORY)11 2657 #endif 2658 2659 #ifndef PROG_30_STDSEAMLESSVDM 2660 #define PROG_30_STDSEAMLESSVDM (PROGCATEGORY)13 2661 #endif 2662 2663 case PROG_WINDOW_REAL: // 10 2664 case PROG_30_STD: // 11 2665 case PROG_WINDOW_AUTO: // 12 2666 case PROG_30_STDSEAMLESSVDM: // 13 2667 case PROG_30_STDSEAMLESSCOMMON: // 14 2668 case PROG_31_STDSEAMLESSVDM: // 15 2669 case PROG_31_STDSEAMLESSCOMMON: // 16 2670 case PROG_31_STD: // 20 2671 fIsWindowsApp = TRUE; 2672 break; 2673 } 2674 2655 2675 /* 2656 * "*" for command sessions:2676 * command lines fixups: 2657 2677 * 2658 2678 */ 2659 2679 2660 if ( fIsWindowsEnhApp)2680 if (strcmp(ProgDetails.pszExecutable, "*") == 0) 2661 2681 { 2662 // enhanced Win-OS/2 session: 2663 PSZ psz = NULL; 2664 if (strParamsPatched.ulLength) 2665 // "/3 " + existing params 2666 psz = strdup(strParamsPatched.psz); 2667 2668 xstrcpy(&strParamsPatched, "/3 ", 0); 2669 2670 if (psz) 2682 /* 2683 * "*" for command sessions: 2684 * 2685 */ 2686 2687 if (fIsWindowsEnhApp) 2671 2688 { 2672 xstrcat(&strParamsPatched, psz, 0); 2673 free(psz); 2689 // enhanced Win-OS/2 session: 2690 PSZ psz = NULL; 2691 if (strParamsPatched.ulLength) 2692 // "/3 " + existing params 2693 psz = strdup(strParamsPatched.psz); 2694 2695 xstrcpy(&strParamsPatched, "/3 ", 0); 2696 2697 if (psz) 2698 { 2699 xstrcat(&strParamsPatched, psz, 0); 2700 free(psz); 2701 } 2702 } 2703 2704 if (fIsWindowsApp) 2705 { 2706 // cheat: WinStartApp doesn't support NULL 2707 // for Win-OS2 sessions, so manually start winos2.com 2708 ProgDetails.pszExecutable = "WINOS2.COM"; 2709 // this is a DOS app, so fix this to DOS fullscreen 2710 ProgDetails.progt.progc = PROG_VDM; 2711 } 2712 else 2713 // for all other executable types 2714 // (including OS/2 and DOS sessions), 2715 // set pszExecutable to NULL; this will 2716 // have WinStartApp start a cmd shell 2717 ProgDetails.pszExecutable = NULL; 2718 2719 } // end if (strcmp(pProgDetails->pszExecutable, "*") == 0) 2720 else 2721 switch (ProgDetails.progt.progc) 2722 { 2723 /* 2724 * .CMD files fixups 2725 * 2726 */ 2727 2728 case PROG_FULLSCREEN: // OS/2 fullscreen 2729 case PROG_WINDOWABLEVIO: // OS/2 window 2730 { 2731 PSZ pszExtension = doshGetExtension(ProgDetails.pszExecutable); 2732 if (pszExtension) 2733 { 2734 if (stricmp(pszExtension, "CMD") == 0) 2735 { 2736 CallBatchCorrectly(&ProgDetails, 2737 &strParamsPatched, 2738 "OS2_SHELL", 2739 "CMD.EXE"); 2740 } 2741 } 2742 break; } 2743 2744 case PROG_VDM: // DOS fullscreen 2745 case PROG_WINDOWEDVDM: // DOS window 2746 { 2747 PSZ pszExtension = doshGetExtension(ProgDetails.pszExecutable); 2748 if (pszExtension) 2749 { 2750 if (stricmp(pszExtension, "BAT") == 0) 2751 { 2752 CallBatchCorrectly(&ProgDetails, 2753 &strParamsPatched, 2754 NULL, 2755 "COMMAND.COM"); 2756 } 2757 } 2758 break; } 2759 } // end switch (ProgDetails.progt.progc) 2760 2761 /* 2762 * Fix environment for Win-OS/2 2763 * 2764 */ 2765 2766 if ( !(xstrIsString(ProgDetails.pszEnvironment)) // env empty 2767 && (fIsWindowsApp) // and win-os2 app 2768 ) 2769 { 2770 ULONG ulSize = 0; 2771 // get default environment (from Win-OS/2 settings object) 2772 // from OS2.INI 2773 PSZ pszDefEnv = prfhQueryProfileData(HINI_USER, 2774 "WINOS2", 2775 "PM_GlobalWindows31Settings", 2776 &ulSize); 2777 if (pszDefEnv) 2778 { 2779 PSZ pszDefEnv2 = (PSZ)malloc(ulSize + 2); 2780 if (pszDefEnv2) 2781 { 2782 PSZ p = pszDefEnv2; 2783 memset(pszDefEnv2, 0, ulSize + 2); 2784 memcpy(pszDefEnv2, pszDefEnv, ulSize); 2785 2786 for (p = pszDefEnv2; 2787 p < pszDefEnv2 + ulSize; 2788 p++) 2789 if (*p == ';') 2790 *p = 0; 2791 2792 // okay.... now we got an OS/2-style environment 2793 // with 0, 0, 00 strings 2794 2795 pszWinOS2Env = pszDefEnv2; // freed below 2796 2797 // use this 2798 ProgDetails.pszEnvironment = pszWinOS2Env; 2799 } 2800 2801 free(pszDefEnv); 2674 2802 } 2675 2803 } 2676 2804 2677 if (fIsWindowsApp) 2678 { 2679 // cheat: WinStartApp doesn't support NULL 2680 // for Win-OS2 sessions, so manually start winos2.com 2681 ProgDetails.pszExecutable = "WINOS2.COM"; 2682 // this is a DOS app, so fix this to DOS fullscreen 2683 ProgDetails.progt.progc = PROG_VDM; 2684 } 2685 else 2686 // for all other executable types 2687 // (including OS/2 and DOS sessions), 2688 // set pszExecutable to NULL; this will 2689 // have WinStartApp start a cmd shell 2690 ProgDetails.pszExecutable = NULL; 2691 2692 } // end if (strcmp(pProgDetails->pszExecutable, "*") == 0) 2693 else 2694 switch (ProgDetails.progt.progc) 2695 { 2696 /* 2697 * .CMD files fixups 2698 * 2699 */ 2700 2701 case PROG_FULLSCREEN: // OS/2 fullscreen 2702 case PROG_WINDOWABLEVIO: // OS/2 window 2703 { 2704 PSZ pszExtension = doshGetExtension(ProgDetails.pszExecutable); 2705 if (pszExtension) 2706 { 2707 if (stricmp(pszExtension, "CMD") == 0) 2708 { 2709 CallBatchCorrectly(&ProgDetails, 2710 &strParamsPatched, 2711 "OS2_SHELL", 2712 "CMD.EXE"); 2713 } 2714 } 2715 break; } 2716 2717 case PROG_VDM: // DOS fullscreen 2718 case PROG_WINDOWEDVDM: // DOS window 2719 { 2720 PSZ pszExtension = doshGetExtension(ProgDetails.pszExecutable); 2721 if (pszExtension) 2722 { 2723 if (stricmp(pszExtension, "BAT") == 0) 2724 { 2725 CallBatchCorrectly(&ProgDetails, 2726 &strParamsPatched, 2727 NULL, 2728 "COMMAND.COM"); 2729 } 2730 } 2731 break; } 2732 } // end switch (ProgDetails.progt.progc) 2733 2734 /* 2735 * Fix environment for Win-OS/2 2736 * 2737 */ 2738 2739 if ( !(xstrIsString(ProgDetails.pszEnvironment)) // env empty 2740 && (fIsWindowsApp) // and win-os2 app 2741 ) 2742 { 2743 ULONG ulSize = 0; 2744 // get default environment (from Win-OS/2 settings object) 2745 // from OS2.INI 2746 PSZ pszDefEnv = prfhQueryProfileData(HINI_USER, 2747 "WINOS2", 2748 "PM_GlobalWindows31Settings", 2749 &ulSize); 2750 if (pszDefEnv) 2751 { 2752 PSZ pszDefEnv2 = (PSZ)malloc(ulSize + 2); 2753 if (pszDefEnv2) 2754 { 2755 PSZ p = pszDefEnv2; 2756 memset(pszDefEnv2, 0, ulSize + 2); 2757 memcpy(pszDefEnv2, pszDefEnv, ulSize); 2758 2759 for (p = pszDefEnv2; 2760 p < pszDefEnv2 + ulSize; 2761 p++) 2762 if (*p == ';') 2763 *p = 0; 2764 2765 // okay.... now we got an OS/2-style environment 2766 // with 0, 0, 00 strings 2767 2768 pszWinOS2Env = pszDefEnv2; // freed below 2769 2770 // use this 2771 ProgDetails.pszEnvironment = pszWinOS2Env; 2772 } 2773 2774 free(pszDefEnv); 2775 } 2776 } 2777 2778 // _Pmpf((__FUNCTION__ ": calling WinStartApp")); 2779 // _Pmpf((" exec: %s", 2780 // (ProgDetails.pszExecutable) 2781 // ? ProgDetails.pszExecutable 2782 // : "NULL")); 2783 // _Pmpf((" startupDir: %s", 2784 // (ProgDetails.pszStartupDir) 2785 // ? ProgDetails.pszStartupDir 2786 // : "NULL")); 2787 // _Pmpf((" params: %s", 2788 // (pszParamsPatched) 2789 // ? pszParamsPatched 2790 // : "NULL")); 2791 // _Pmpf((" new progc: 0x%lX", ProgDetails.progt.progc)); 2792 2793 ProgDetails.pszParameters = strParamsPatched.psz; 2794 2795 happ = WinStartApp(hwndNotify, 2796 // receives WM_APPTERMINATENOTIFY 2797 &ProgDetails, 2798 strParamsPatched.psz, 2799 NULL, // "reserved", PMREF says... 2800 SAF_INSTALLEDCMDLINE); 2801 // we MUST use SAF_INSTALLEDCMDLINE 2802 // or no Win-OS/2 session will start... 2803 // whatever is going on here... Warp 4 FP11 2804 2805 // do not use SAF_STARTCHILDAPP, or the 2806 // app will be terminated automatically 2807 // when the WPS terminates! 2808 2809 // _Pmpf((__FUNCTION__ ": got happ 0x%lX", happ)); 2810 2811 xstrClear(&strParamsPatched); 2812 if (pszWinOS2Env) 2813 free(pszWinOS2Env); 2805 // _Pmpf((__FUNCTION__ ": calling WinStartApp")); 2806 // _Pmpf((" exec: %s", 2807 // (ProgDetails.pszExecutable) 2808 // ? ProgDetails.pszExecutable 2809 // : "NULL")); 2810 // _Pmpf((" startupDir: %s", 2811 // (ProgDetails.pszStartupDir) 2812 // ? ProgDetails.pszStartupDir 2813 // : "NULL")); 2814 // _Pmpf((" params: %s", 2815 // (pszParamsPatched) 2816 // ? pszParamsPatched 2817 // : "NULL")); 2818 // _Pmpf((" new progc: 0x%lX", ProgDetails.progt.progc)); 2819 2820 ProgDetails.pszParameters = strParamsPatched.psz; 2821 2822 happ = WinStartApp(hwndNotify, 2823 // receives WM_APPTERMINATENOTIFY 2824 &ProgDetails, 2825 strParamsPatched.psz, 2826 NULL, // "reserved", PMREF says... 2827 SAF_INSTALLEDCMDLINE); 2828 // we MUST use SAF_INSTALLEDCMDLINE 2829 // or no Win-OS/2 session will start... 2830 // whatever is going on here... Warp 4 FP11 2831 2832 // do not use SAF_STARTCHILDAPP, or the 2833 // app will be terminated automatically 2834 // when the WPS terminates! 2835 2836 // _Pmpf((__FUNCTION__ ": got happ 0x%lX", happ)); 2837 2838 xstrClear(&strParamsPatched); 2839 if (pszWinOS2Env) 2840 free(pszWinOS2Env); 2841 } // end if (ProgDetails.pszExecutable) 2814 2842 2815 2843 return (happ);
Note:
See TracChangeset
for help on using the changeset viewer.