Changeset 360
- Timestamp:
- Jun 18, 2009, 8:55:46 PM (16 years ago)
- Location:
- trunk/hlpmgr
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hlpmgr/globalfilelist.h
r26 r360 13 13 typedef TOpenFileEntry* TPOpenFileEntry; 14 14 15 typedef struct 15 typedef struct 16 16 { 17 17 TSubAllocatedSharedMemory FMem; … … 24 24 void CloseGlobalFilelist( TGlobalFilelist* pList ); 25 25 26 HWND FindFileInGlobalFilelist( TGlobalFilelist* pList, 27 char* FilePath ); 26 HWND FindFileInGlobalFilelist( TGlobalFilelist* pList, char* FilePath ); 28 27 29 28 #endif 29 -
trunk/hlpmgr/helpinstance.c
r26 r360 17 17 if ( ! pHelpInstance -> FViewerStarted ) 18 18 { 19 // get focus frame 19 // get focus frame 20 20 FocusFrame = GetTopLevelWindow( WinQueryFocus( HWND_DESKTOP ) ); 21 21 // associate viewer with that. … … 77 77 mp2 ); 78 78 if ( ok ) 79 LogEvent( " Posted OK" ); 79 LogEvent( " Posted OK" ); 80 80 else 81 81 LogEvent( " WinPostMsg failed" ); … … 86 86 //-------------------------------------------------------------------------------- 87 87 void PostQueuedViewerMessages( TPHelpInstance pHelpInstance ) 88 { 88 { 89 89 int i; 90 90 TQueuedViewerMessage ViewerMessage; … … 119 119 //-------------------------------------------------------------------------------- 120 120 121 // Add the given window to the list of associated 121 // Add the given window to the list of associated 122 122 // windows for this help instance 123 123 //-------------------------------------------------------------------------------- … … 129 129 pHelpInstance ); 130 130 131 if ( IsWindowAssociated( pHelpInstance, hwnd ) ) 132 { 131 if ( IsWindowAssociated( pHelpInstance, hwnd ) ) 132 { 133 133 LogEvent( "Already associated" ); 134 134 return; … … 151 151 152 152 // see if it will fit. 153 if ( pHelpInstance -> FNumApplicationWindows 153 if ( pHelpInstance -> FNumApplicationWindows 154 154 >= pHelpInstance -> FMaxApplicationWindows ) 155 155 { … … 160 160 else 161 161 // double space 162 pHelpInstance -> FMaxApplicationWindows *= 2; 162 pHelpInstance -> FMaxApplicationWindows *= 2; 163 163 164 164 LogEvent( "AssociateWIndow: allocating list space to %d", … … 166 166 167 167 // reallocate memory. 168 pHelpInstance -> FApplicationWindows 169 = (HWND*) realloc( pHelpInstance -> FApplicationWindows, 170 pHelpInstance -> FMaxApplicationWindows 168 pHelpInstance -> FApplicationWindows 169 = (HWND*) realloc( pHelpInstance -> FApplicationWindows, 170 pHelpInstance -> FMaxApplicationWindows 171 171 * sizeof( HWND ) ); 172 172 } 173 173 174 174 pHelpInstance -> 175 175 FApplicationWindows[ pHelpInstance -> FNumApplicationWindows ] … … 180 180 LogEvent( "AssociateWindow: Now have %d windows associated", 181 181 pHelpInstance -> FNumApplicationWindows ); 182 } 183 184 // Removes the given window from the list of associated 182 } 183 184 // Removes the given window from the list of associated 185 185 // windows for this help instance (if present) 186 186 //-------------------------------------------------------------------------------- … … 199 199 j = i; 200 200 while( j < pHelpInstance -> FNumApplicationWindows - 1 ) 201 { 201 { 202 202 pHelpInstance -> FApplicationWindows[ j ] 203 203 = pHelpInstance -> FApplicationWindows[ j + 1 ]; … … 245 245 ulMagicNumber = WinQueryWindowULong( hwnd, QWL_HELPINSTANCEMAGICNUMBER ); 246 246 247 if ( ulMagicNumber != HELPINSTANCEMAGICNUMBER ) 247 if ( ulMagicNumber != HELPINSTANCEMAGICNUMBER ) 248 248 return NULL; 249 249 … … 263 263 // free copy of resource 264 264 FreeHelpTable( & ( pHelpInstance -> pHelpTable ) ); 265 } 265 } 266 266 267 267 //-------------------------------------------------------------------------------- … … 276 276 pHelpInstance -> FNumApplicationWindows = 0; 277 277 pHelpInstance -> FMaxApplicationWindows = 0; 278 pHelpInstance -> FApplicationWindows = NULL; 279 280 pHelpInstance -> FActiveWindow = NULLHANDLE; 278 pHelpInstance -> FApplicationWindows = NULL; 279 280 pHelpInstance -> FActiveWindow = NULLHANDLE; 281 281 282 282 return pHelpInstance; 283 283 } 284 284 -
trunk/hlpmgr/misc.c
r26 r360 5 5 #include "misc.h" 6 6 7 USHORT APIENTRY NHMSearchMIndex( PVOID pInstance, 8 HWND hwnd, 7 USHORT APIENTRY NHMSearchMIndex( PVOID pInstance, 8 HWND hwnd, 9 9 PSZ pchText ) 10 10 { … … 13 13 } 14 14 15 // e.g. p = DBMstrtok2(EnvStr, "; \0"); 15 // e.g. p = DBMstrtok2(EnvStr, "; \0"); 16 16 // probably just use strtok unless you really want to support dbcs 17 17 PCH APIENTRY NHMDBMstrtok2( PCH s1, PCH s2 ) … … 28 28 } 29 29 30 // e.g. 31 // pCountry = (PVOID)WinSendMsg ( _hwndMIndexInstance, 32 // HM_QPSTRUCT, 33 // MPFROMSHORT(STRUCT_COUNTRY_INFO), 30 // e.g. 31 // pCountry = (PVOID)WinSendMsg ( _hwndMIndexInstance, 32 // HM_QPSTRUCT, 33 // MPFROMSHORT(STRUCT_COUNTRY_INFO), 34 34 // NULL ); 35 35 // if ( MscStriCmp( TabText.pString, szBuf1, pCountry ) ) … … 44 44 45 45 // Attempt to see if we can get OpenChat running (not with help tho) 46 BOOL APIENTRY NHM32SetHelpDatabase(PINSTANCE pInstance, PSZ DatabaseName, USHORT usObtimizeType) 46 BOOL APIENTRY NHM32SetHelpDatabase(PINSTANCE pInstance, PSZ DatabaseName, USHORT usObtimizeType) 47 47 { 48 48 // Jolly good, whatever you say... … … 71 71 return TRUE; 72 72 } 73 73 -
trunk/hlpmgr/sharedmemory.c
r26 r360 17 17 char FullName[ 260 ]; 18 18 19 pSharedMemory -> FFirst = TRUE; 19 pSharedMemory -> FFirst = TRUE; 20 20 21 21 strcpy( FullName, "\\SHAREMEM\\" ); … … 31 31 { 32 32 LogEvent( " Unable to create shared mem: %d", rc ); 33 if ( rc == ERROR_ALREADY_EXISTS ) 33 if ( rc == ERROR_ALREADY_EXISTS ) 34 34 { 35 35 LogEvent( " - Already exists, open" ); … … 55 55 while( TRUE ) 56 56 { 57 rc = DosOpenMutexSem( pszName, 58 phmtx ); 57 rc = DosOpenMutexSem( pszName, 58 phmtx ); 59 59 60 60 if ( rc != ERROR_SEM_NOT_FOUND ) … … 62 62 break; 63 63 64 rc = DosCreateMutexSem( pszName, 64 rc = DosCreateMutexSem( pszName, 65 65 phmtx, 66 0, 67 FALSE ); 66 0, 67 FALSE ); 68 68 if ( rc != ERROR_DUPLICATE_NAME ) 69 69 // ok, or some error … … 91 91 ULONG Size, 92 92 ULONG ReserveSize, // size to reserve at start of memory 93 TSubAllocatedSharedMemory* pSharedMemory ) 93 TSubAllocatedSharedMemory* pSharedMemory ) 94 94 { 95 95 APIRET rc; … … 113 113 LogEvent( " semaphore name: %s", SemaphoreName ); 114 114 115 rc = OpenOrCreateMutex( SemaphoreName, 115 rc = OpenOrCreateMutex( SemaphoreName, 116 116 & StartupSemaphore ); 117 117 if ( rc != 0 ) … … 151 151 } 152 152 153 pSharedMemory -> FAllocationArea = 153 pSharedMemory -> FAllocationArea = 154 154 (PBYTE) pSharedMemory -> FMem.FPointer 155 155 + ActualReserveSize; … … 207 207 void** p ) 208 208 { 209 APIRET rc; 209 APIRET rc; 210 210 PULONG pSize; 211 211 ULONG Size; … … 221 221 222 222 *p = NULL; 223 } 223 } 224 224 225 225 void ReleaseSubAllocatedSharedMemory( TSubAllocatedSharedMemory* pSharedMemory ) … … 232 232 ReleaseSharedMemory( & pSharedMemory -> FMem ); 233 233 } 234 234 -
trunk/hlpmgr/sharedmemory.h
r26 r360 7 7 // in the memory. 8 8 9 typedef struct 9 typedef struct 10 10 { 11 11 void* FPointer; … … 25 25 // Otherwise the Data property should not be used. 26 26 27 typedef struct 27 typedef struct 28 28 { 29 29 TSharedMemory FMem; 30 void* FAllocationArea; 30 void* FAllocationArea; 31 31 } TSubAllocatedSharedMemory; 32 32 … … 34 34 ULONG Size, 35 35 ULONG ReserveSize, // size to reserve at start of memory 36 TSubAllocatedSharedMemory* pSharedMemory ); 36 TSubAllocatedSharedMemory* pSharedMemory ); 37 37 38 38 // suballocate space of the given size … … 51 51 52 52 #endif 53 -
trunk/hlpmgr/utility.c
r26 r360 1 #include <stdlib.h> 1 #include <stdlib.h> 2 2 #include <string.h> 3 3 … … 8 8 { 9 9 ULONG buffer; 10 DosQuerySysInfo( QSV_BOOT_DRIVE, 10 DosQuerySysInfo( QSV_BOOT_DRIVE, 11 11 QSV_BOOT_DRIVE, 12 12 & buffer, … … 40 40 while( TRUE ) 41 41 { 42 parent = WinQueryWindow( hwnd, QW_PARENT ); 42 parent = WinQueryWindow( hwnd, QW_PARENT ); 43 43 if ( parent == hDesktopWindow 44 44 || parent == NULLHANDLE ) 45 45 // this is a frame (top level) window 46 46 break; 47 hwnd = parent; 47 hwnd = parent; 48 48 } 49 49 … … 61 61 LogEvent( "IsStandardWindowClass" ); 62 62 63 if ( WinQueryClassName( hwnd, 63 if ( WinQueryClassName( hwnd, 64 64 sizeof( szClassName ), 65 65 szClassName ) == 0 ) … … 87 87 char* source ) 88 88 { 89 if ( *dest != NULL ) 89 if ( *dest != NULL ) 90 90 { 91 91 free( *dest ); 92 92 *dest = NULL; 93 93 } 94 95 if ( source == NULL ) 94 95 if ( source == NULL ) 96 96 return; 97 97 … … 99 99 strcpy( *dest, source ); 100 100 } 101 101 -
trunk/hlpmgr/utility.h
r26 r360 32 32 BOOL IsStandardWindowClass( HWND hwnd, PSZ ClassID ); 33 33 34 // make a memory copy of the given source string into 34 // make a memory copy of the given source string into 35 35 // dest. Accepts NULLs for either parameter. 36 36 void StoreString( char** dest, … … 38 38 39 39 #endif 40
Note:
See TracChangeset
for help on using the changeset viewer.