source: trunk/dll/objwin.c@ 1077

Last change on this file since 1077 was 1077, checked in by Steven Levine, 17 years ago

Enhance Fortify infrastructure
Add Fortify_SetOwner Fortify_ChangeOwner Fortify_ChangeScope
Add FORTIFY_VERBOSE_SCOPE_ENTER_EXIT support
Add more fm/2 Fortify tooling and rework existing tooling for correct nesting
Still lots to do for cross-thread allocations
Add misc.h
Add walkem.h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1
2/***********************************************************************
3
4 $Id: objwin.c 1077 2008-07-18 18:11:54Z stevenhl $
5
6 Object windows
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2006, 2008 Steven H.Levine
10
11 26 Jul 06 SHL Check more run time errors
12 02 Nov 06 SHL Comments
13 30 Mar 07 GKY Remove GetPString for window class names
14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
15 08 Jul 08 SHL Correct Fortify_LeaveScope usage and avoid spurious reports
16
17***********************************************************************/
18
19#define INCL_DOS
20#define INCL_WIN
21#define INCL_LONGLONG // dircnrs.h
22
23#include "fm3dlg.h"
24#include "fm3str.h"
25#include "arccnrs.h" // ArcObjWndProc
26#include "errutil.h" // Win_Error
27#include "fm3dll.h"
28#include "fortify.h"
29
30static PSZ pszSrcFile = __FILE__;
31
32MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
33{
34 DIRCNRDATA *dcd;
35
36 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
37 if (dcd) {
38 switch (dcd->type) {
39 case DIR_FRAME:
40 return DirObjWndProc(hwnd, msg, mp1, mp2);
41 case TREE_FRAME:
42 return TreeObjWndProc(hwnd, msg, mp1, mp2);
43 case COLLECTOR_FRAME:
44 return CollectorObjWndProc(hwnd, msg, mp1, mp2);
45 case ARC_FRAME:
46 return ArcObjWndProc(hwnd, msg, mp1, mp2);
47 }
48 }
49 return WinDefWindowProc(hwnd, msg, mp1, mp2);
50}
51
52VOID MakeObjWin(VOID * args)
53{
54 HWND ObjectHwnd;
55 HAB hab2;
56 HMQ hmq2;
57 QMSG qmsg2;
58
59 hab2 = WinInitialize(0);
60 if (hab2) {
61 hmq2 = WinCreateMsgQueue(hab2, 512);
62 if (hmq2) {
63 DosError(FERR_DISABLEHARDERR);
64 WinRegisterClass(hab2,
65 WC_OBJECTWINDOW,
66 ObjectWndProc, 0, sizeof(PVOID));
67 ObjectHwnd = WinCreateWindow(HWND_OBJECT,
68 WC_OBJECTWINDOW,
69 (PSZ) NULL,
70 0,
71 0L,
72 0L,
73 0L,
74 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
75 if (!ObjectHwnd)
76 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
77 IDS_WINCREATEWINDOW);
78 else {
79# ifdef FORTIFY
80 Fortify_EnterScope();
81# endif
82 WinSetWindowPtr(ObjectHwnd, QWL_USER, args);
83 /* initially populate container */
84 // 18 Jul 08 SHL fixme to know if this really kills WM_CREATE
85 WinSendMsg(ObjectHwnd, UM_SETUP, MPVOID, MPVOID);
86 PostMsg(ObjectHwnd, UM_RESCAN, MPVOID, MPVOID);
87 priority_normal();
88 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
89 WinDispatchMsg(hab2, &qmsg2);
90 WinDestroyWindow(ObjectHwnd);
91# ifdef FORTIFY
92 {
93 // Allow container to close and free data
94 HWND hwndCnr = ((DIRCNRDATA *)args)->hwndCnr;
95 USHORT i;
96 for (i = 0; WinIsWindow(hab2, hwndCnr) && i < 10; i++)
97 DosSleep(50);
98 Fortify_LeaveScope();
99 }
100# endif
101 }
102 WinDestroyMsgQueue(hmq2);
103 }
104 WinTerminate(hab2);
105 }
106}
107
108#pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin)
Note: See TracBrowser for help on using the repository browser.