Changeset 687 for trunk/dll/misc.c


Ignore:
Timestamp:
Jun 10, 2007, 10:41:52 PM (18 years ago)
Author:
Gregg Young
Message:

Add CheckPmDrgLimit function to fix crash when dragging to FM/2 for other apps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/misc.c

    r555 r687  
    4747
    4848#pragma alloc_text(MAINWND5,SetSysMenu)
    49 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow)
     49#pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window)
    5050#pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)
    5151#pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)
     
    7474#define ORD_DOS32QUERYEXTLIBPATH 874
    7575#endif
     76
     77BOOL IsFm2Window(HWND hwnd, BOOL chkTid)
     78{
     79    PIB *ppib;
     80    TIB *ptib;
     81    APIRET rc;
     82
     83    rc = DosGetInfoBlocks(&ptib, &ppib);
     84    if (rc)
     85      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     86                "DosGetInfoBlocks");
     87    else {
     88      PID pid;
     89      TID tid;
     90
     91      if (WinQueryWindowProcess(hwnd, &pid, &tid))
     92        if (chkTid) {
     93          // If window owned by FM2 process on same thread?
     94          if (pid == ppib->pib_ulpid && tid == ptib->tib_ptib2->tib2_ultid)
     95            return TRUE;
     96        }
     97      //Window is owned by FM2
     98        else if (pid == ppib->pib_ulpid)
     99          return TRUE;
     100    }
     101    return FALSE;
     102}
    76103
    77104VOID SetShiftState(VOID)
     
    13641391
    13651392  if (!rc) {
    1366     PIB *ppib;
     1393   /* PIB *ppib;
    13671394    TIB *ptib;
    13681395
     
    13741401      if (WinQueryWindowProcess(h, &pid, &tid)) {
    13751402        // If window owned by some other process or some other thread?
    1376         if (pid != ppib->pib_ulpid || tid != ptib->tib_ptib2->tib2_ultid) {
     1403        if (pid != ppib->pib_ulpid || tid != ptib->tib_ptib2->tib2_ultid)*/
     1404      if(!IsFm2Window(h, 1)){
     1405          QMSG qmsg;
    13771406          for (;;) {
    13781407            DosSleep(1L);
     
    13861415          }                             // for
    13871416        }
    1388       }
    1389     }
    1390   }
     1417    }
    13911418  return rc;
    13921419}
Note: See TracChangeset for help on using the changeset viewer.