[2] | 1 | #define INCL_WIN
|
---|
| 2 | #define INCL_GPI
|
---|
| 3 | #define INCL_DOS
|
---|
| 4 | #define INCL_DOSERRORS
|
---|
| 5 |
|
---|
| 6 | #include <os2.h>
|
---|
| 7 | #include <stdlib.h>
|
---|
| 8 | #include <stdio.h>
|
---|
| 9 | #include <string.h>
|
---|
| 10 | #include <ctype.h>
|
---|
| 11 | #include <share.h>
|
---|
| 12 | #include "fm3dll.h"
|
---|
| 13 | #include "fm3dlg.h"
|
---|
| 14 | #include "fm3str.h"
|
---|
| 15 | #include "mle.h"
|
---|
| 16 |
|
---|
| 17 | #pragma data_seg(DATA2)
|
---|
| 18 | #pragma alloc_text(INIS,EnumAppNames,GetKeyData,EnumKeyNames,AddIniProc,IniProc,BackupIni,ChangeIniProc,SwapIniProc,IniLBSubProc,IniLBSubProc2,CopyIni,CompareIni,IntraIniProc,FilterIniProc)
|
---|
| 19 | #pragma alloc_text(STARTUP,StartIniEditor)
|
---|
| 20 |
|
---|
| 21 | typedef struct {
|
---|
| 22 | USHORT size;
|
---|
| 23 | CHAR ininame[CCHMAXPATH];
|
---|
| 24 | HINI hini;
|
---|
| 25 | BOOL working;
|
---|
| 26 | BOOL edit;
|
---|
| 27 | BOOL confirm;
|
---|
| 28 | HWND hwndMenu;
|
---|
| 29 | CHAR applname[CCHMAXPATH];
|
---|
| 30 | CHAR keyname[CCHMAXPATH];
|
---|
| 31 | CHAR *data;
|
---|
| 32 | ULONG datalen;
|
---|
| 33 | SHORT appindex;
|
---|
| 34 | SHORT keyindex;
|
---|
| 35 | BOOL dontclose;
|
---|
| 36 | USHORT currid;
|
---|
| 37 | BOOL isbinary;
|
---|
| 38 | HWND hwndIni;
|
---|
| 39 | HWND hwndApp;
|
---|
| 40 | HWND hwndKey;
|
---|
| 41 | HWND hwndData;
|
---|
| 42 | HWND hwndPopup;
|
---|
| 43 | HWND hwndCurrent;
|
---|
| 44 | } INIDATA;
|
---|
| 45 |
|
---|
| 46 | typedef struct {
|
---|
| 47 | USHORT size;
|
---|
| 48 | USHORT action;
|
---|
| 49 | CHAR filename1[CCHMAXPATH];
|
---|
| 50 | CHAR filename2[CCHMAXPATH];
|
---|
| 51 | CHAR app[CCHMAXPATH];
|
---|
| 52 | CHAR key[CCHMAXPATH];
|
---|
| 53 | CHAR app2[CCHMAXPATH];
|
---|
| 54 | CHAR key2[CCHMAXPATH];
|
---|
| 55 | HWND hwndDlg;
|
---|
| 56 | HWND hwndSource;
|
---|
| 57 | BOOL confirm;
|
---|
| 58 | } INIREC;
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | VOID CopyIni (VOID *args) {
|
---|
| 62 |
|
---|
| 63 | INIREC *inirec = (INIREC *)args;
|
---|
| 64 | HAB hab2;
|
---|
| 65 | HMQ hmq2;
|
---|
| 66 | HINI hini1 = (HINI)0,hini2 = (HINI)0;
|
---|
| 67 | PRFPROFILE cprfp;
|
---|
| 68 | CHAR userini[CCHMAXPATH],sysini[CCHMAXPATH];
|
---|
| 69 |
|
---|
| 70 | if(inirec) {
|
---|
| 71 | hab2 = WinInitialize(0);
|
---|
| 72 | if(hab2) {
|
---|
| 73 | hmq2 = WinCreateMsgQueue(hab2,0);
|
---|
| 74 | if(hmq2) {
|
---|
| 75 | WinCancelShutdown(hmq2,TRUE);
|
---|
| 76 | *userini = *sysini = 0;
|
---|
| 77 | memset(&cprfp,0,sizeof(PRFPROFILE));
|
---|
| 78 | cprfp.cchUserName = CCHMAXPATH;
|
---|
| 79 | cprfp.cchSysName = CCHMAXPATH;
|
---|
| 80 | cprfp.pszUserName = (PSZ)userini;
|
---|
| 81 | cprfp.pszSysName = (PSZ)sysini;
|
---|
| 82 | if(PrfQueryProfile(hab2,&cprfp)) {
|
---|
| 83 | if(!stricmp(cprfp.pszUserName,inirec->filename1))
|
---|
| 84 | hini1 = HINI_USERPROFILE;
|
---|
| 85 | else if(!stricmp(cprfp.pszSysName,inirec->filename1))
|
---|
| 86 | hini1 = HINI_SYSTEMPROFILE;
|
---|
| 87 | if(!stricmp(cprfp.pszUserName,inirec->filename2))
|
---|
| 88 | hini2 = HINI_USERPROFILE;
|
---|
| 89 | else if(!stricmp(cprfp.pszSysName,inirec->filename2))
|
---|
| 90 | hini2 = HINI_SYSTEMPROFILE;
|
---|
| 91 | }
|
---|
| 92 | if(!hini1)
|
---|
| 93 | hini1 = PrfOpenProfile(hab2,inirec->filename1);
|
---|
| 94 | if(!hini2) {
|
---|
| 95 | if(!stricmp(inirec->filename1,inirec->filename2))
|
---|
| 96 | hini2 = hini1;
|
---|
| 97 | else
|
---|
| 98 | hini2 = PrfOpenProfile(hab2,inirec->filename2);
|
---|
| 99 | }
|
---|
| 100 | if(hini1 && hini2 && (*inirec->app2 || hini1 != hini2)) {
|
---|
| 101 |
|
---|
| 102 | PVOID pDataK,pData;
|
---|
| 103 | PBYTE pCurrentK;
|
---|
| 104 | ULONG ulSize = 0L;
|
---|
| 105 |
|
---|
| 106 | if(inirec->action == IDM_MOVE || inirec->action == IDM_COPY) {
|
---|
| 107 | if(!*inirec->key) {
|
---|
| 108 | if(inirec->confirm &&
|
---|
| 109 | PrfQueryProfileSize(hini1,(PSZ)((*inirec->app2) ?
|
---|
| 110 | inirec->app2 : inirec->app),NULL,
|
---|
| 111 | (PULONG)&ulSize) && ulSize) {
|
---|
| 112 | if(saymsg(MB_YESNOCANCEL,
|
---|
| 113 | HWND_DESKTOP,
|
---|
| 114 | GetPString(IDS_CONFIRMTEXT),
|
---|
| 115 | GetPString(IDS_INIOVERAPPNAMETEXT),
|
---|
| 116 | ((*inirec->app2) ? inirec->app2 : inirec->app),
|
---|
| 117 | inirec->filename1) !=
|
---|
| 118 | MBID_YES)
|
---|
| 119 | goto Abort;
|
---|
| 120 | }
|
---|
| 121 | if(PrfQueryProfileSize(hini2,
|
---|
| 122 | (PSZ)inirec->app,
|
---|
| 123 | NULL,
|
---|
| 124 | (PULONG)&ulSize) &&
|
---|
| 125 | ulSize) {
|
---|
| 126 | pDataK = malloc(ulSize); /* allocate space for keynames */
|
---|
| 127 | if(pDataK) {
|
---|
| 128 | /* get keynames */
|
---|
| 129 | if(PrfQueryProfileString(hini2,
|
---|
| 130 | (PSZ)inirec->app,
|
---|
| 131 | NULL,
|
---|
| 132 | "\0",
|
---|
| 133 | pDataK,
|
---|
| 134 | ulSize)) {
|
---|
| 135 | pCurrentK = pDataK;
|
---|
| 136 | /* step through keynames */
|
---|
| 137 | while (*pCurrentK) {
|
---|
| 138 | if(PrfQueryProfileSize(hini2,inirec->app,
|
---|
| 139 | pCurrentK,
|
---|
| 140 | (PULONG)&ulSize) &&
|
---|
| 141 | ulSize) {
|
---|
| 142 | pData = malloc(ulSize);
|
---|
| 143 | if(pData) {
|
---|
| 144 | /* get data */
|
---|
| 145 | if(PrfQueryProfileData(hini2,inirec->app,
|
---|
| 146 | pCurrentK,
|
---|
| 147 | pData,
|
---|
| 148 | (PULONG)&ulSize))
|
---|
| 149 | /* write data to new ini file */
|
---|
| 150 | PrfWriteProfileData(hini1,((*inirec->app2) ?
|
---|
| 151 | inirec->app2 : inirec->app),
|
---|
| 152 | pCurrentK,pData,
|
---|
| 153 | ulSize);
|
---|
| 154 | free(pData); /* free data */
|
---|
| 155 | }
|
---|
| 156 | }
|
---|
| 157 | while(*pCurrentK) /* next keyname */
|
---|
| 158 | pCurrentK++;
|
---|
| 159 | pCurrentK++;
|
---|
| 160 | }
|
---|
| 161 | }
|
---|
| 162 | free(pDataK); /* free keynames */
|
---|
| 163 | }
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 | else {
|
---|
| 167 | if(inirec->confirm &&
|
---|
| 168 | PrfQueryProfileSize(hini1,(PSZ)((*inirec->app2) ?
|
---|
| 169 | inirec->app2 : inirec->app),
|
---|
| 170 | ((*inirec->key2) ?
|
---|
| 171 | inirec->key2 : inirec->key),
|
---|
| 172 | (PULONG)&ulSize) && ulSize) {
|
---|
| 173 | if(saymsg(MB_YESNOCANCEL,
|
---|
| 174 | HWND_DESKTOP,
|
---|
| 175 | GetPString(IDS_CONFIRMTEXT),
|
---|
| 176 | GetPString(IDS_INIOVERAPPKEYNAMETEXT),
|
---|
| 177 | ((*inirec->app2) ? inirec->app2 : inirec->app),
|
---|
| 178 | ((*inirec->key2) ? inirec->key2 : inirec->key),
|
---|
| 179 | inirec->filename1) !=
|
---|
| 180 | MBID_YES)
|
---|
| 181 | goto Abort;
|
---|
| 182 | }
|
---|
| 183 | if(PrfQueryProfileSize(hini2,inirec->app,
|
---|
| 184 | inirec->key,
|
---|
| 185 | (PULONG)&ulSize) &&
|
---|
| 186 | ulSize) {
|
---|
| 187 | pData = malloc(ulSize);
|
---|
| 188 | if(pData) {
|
---|
| 189 | /* get data */
|
---|
| 190 | if(PrfQueryProfileData(hini2,inirec->app,
|
---|
| 191 | inirec->key,
|
---|
| 192 | pData,
|
---|
| 193 | (PULONG)&ulSize))
|
---|
| 194 | /* write data to new ini file */
|
---|
| 195 | PrfWriteProfileData(hini1,((*inirec->app2) ?
|
---|
| 196 | inirec->app2 : inirec->app),
|
---|
| 197 | ((*inirec->key2) ?
|
---|
| 198 | inirec->key2 : inirec->key),
|
---|
| 199 | pData,ulSize);
|
---|
| 200 | free(pData); /* free data */
|
---|
| 201 | }
|
---|
| 202 | }
|
---|
| 203 | }
|
---|
| 204 | if(inirec->action == IDM_MOVE) {
|
---|
| 205 | if(inirec->confirm &&
|
---|
| 206 | saymsg(MB_YESNOCANCEL,
|
---|
| 207 | HWND_DESKTOP,
|
---|
| 208 | GetPString(IDS_CONFIRMTEXT),
|
---|
| 209 | GetPString(IDS_INIDELETEMOVEDTEXT),
|
---|
| 210 | inirec->filename2) !=
|
---|
| 211 | MBID_YES)
|
---|
| 212 | goto Abort;
|
---|
| 213 | PrfWriteProfileData(hini2,
|
---|
| 214 | inirec->app,
|
---|
| 215 | ((*inirec->key) ? inirec->key : NULL),
|
---|
| 216 | NULL,
|
---|
| 217 | 0L);
|
---|
| 218 | }
|
---|
| 219 | }
|
---|
| 220 | }
|
---|
| 221 | Abort:
|
---|
| 222 | if(hini1)
|
---|
| 223 | PrfCloseProfile(hini1);
|
---|
| 224 | if(hini2)
|
---|
| 225 | PrfCloseProfile(hini2);
|
---|
| 226 | WinDestroyMsgQueue(hmq2);
|
---|
| 227 | }
|
---|
| 228 | WinTerminate(hab2);
|
---|
| 229 | }
|
---|
| 230 | PostMsg(inirec->hwndDlg,WM_COMMAND,MPFROM2SHORT(INI_REFRESH,0),
|
---|
| 231 | MPVOID);
|
---|
| 232 | if(inirec->action == IDM_MOVE && inirec->hwndSource &&
|
---|
| 233 | inirec->hwndSource != inirec->hwndDlg)
|
---|
| 234 | PostMsg(inirec->hwndSource,WM_COMMAND,MPFROM2SHORT(INI_REFRESH,0),
|
---|
| 235 | MPVOID);
|
---|
| 236 | free(inirec);
|
---|
| 237 | }
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 |
|
---|
| 241 | VOID CompareIni (VOID *args) {
|
---|
| 242 |
|
---|
| 243 | INIREC *inirec = (INIREC *)args;
|
---|
| 244 | HAB hab2;
|
---|
| 245 | HMQ hmq2;
|
---|
| 246 |
|
---|
| 247 | if(inirec) {
|
---|
| 248 | hab2 = WinInitialize(0);
|
---|
| 249 | if(hab2) {
|
---|
| 250 | hmq2 = WinCreateMsgQueue(hab2,0);
|
---|
| 251 | if(hmq2) {
|
---|
| 252 | WinCancelShutdown(hmq2,TRUE);
|
---|
| 253 |
|
---|
| 254 | WinDestroyMsgQueue(hmq2);
|
---|
| 255 | }
|
---|
| 256 | WinTerminate(hab2);
|
---|
| 257 | }
|
---|
| 258 | free(inirec);
|
---|
| 259 | }
|
---|
| 260 | }
|
---|
| 261 |
|
---|
| 262 |
|
---|
| 263 | VOID BackupIni (VOID *args) {
|
---|
| 264 |
|
---|
| 265 | PPRFPROFILE prfp = (PPRFPROFILE)args;
|
---|
| 266 | HAB hab2;
|
---|
| 267 | HMQ hmq2;
|
---|
| 268 | HINI orig = (HINI)0,new;
|
---|
| 269 | PVOID pDataA,pDataK,pData;
|
---|
| 270 | PBYTE pCurrentA,pCurrentK;
|
---|
| 271 | ULONG ulSize = 0L;
|
---|
| 272 | PRFPROFILE cprfp;
|
---|
| 273 | CHAR userini[CCHMAXPATH],sysini[CCHMAXPATH];
|
---|
| 274 |
|
---|
| 275 | if(prfp) {
|
---|
| 276 | hab2 = WinInitialize(0);
|
---|
| 277 | if(hab2) {
|
---|
| 278 | hmq2 = WinCreateMsgQueue(hab2,0);
|
---|
| 279 | if(hmq2) {
|
---|
| 280 | WinCancelShutdown(hmq2,TRUE);
|
---|
| 281 | *userini = *sysini = 0;
|
---|
| 282 | memset(&cprfp,0,sizeof(PRFPROFILE));
|
---|
| 283 | cprfp.cchUserName = CCHMAXPATH;
|
---|
| 284 | cprfp.cchSysName = CCHMAXPATH;
|
---|
| 285 | cprfp.pszUserName = (PSZ)userini;
|
---|
| 286 | cprfp.pszSysName = (PSZ)sysini;
|
---|
| 287 | if(PrfQueryProfile(hab2,&cprfp)) {
|
---|
| 288 | if(!stricmp(cprfp.pszUserName,prfp->pszUserName))
|
---|
| 289 | orig = HINI_USERPROFILE;
|
---|
| 290 | else if(!stricmp(cprfp.pszSysName,prfp->pszUserName))
|
---|
| 291 | orig = HINI_SYSTEMPROFILE;
|
---|
| 292 | }
|
---|
| 293 | if(!orig)
|
---|
| 294 | orig = PrfOpenProfile(hab2,prfp->pszUserName);
|
---|
| 295 | if(orig) {
|
---|
| 296 | new = PrfOpenProfile(hab2,prfp->pszSysName);
|
---|
| 297 | if(new) {
|
---|
| 298 | if(PrfQueryProfileSize(orig,NULL,NULL,(PULONG)&ulSize) && ulSize) {
|
---|
| 299 | pDataA = malloc(ulSize); /* allocate space for applnames */
|
---|
| 300 | if(pDataA) {
|
---|
| 301 | /* get applnames */
|
---|
| 302 | if(PrfQueryProfileString(orig,NULL,NULL,"\0",pDataA,ulSize)) {
|
---|
| 303 | pCurrentA = pDataA;
|
---|
| 304 | /* step through applnames */
|
---|
| 305 | while (*pCurrentA) {
|
---|
| 306 | /* now keynames for this applname */
|
---|
| 307 | if (PrfQueryProfileSize(orig,(PSZ)pCurrentA,NULL,
|
---|
| 308 | (PULONG)&ulSize) && ulSize) {
|
---|
| 309 | pDataK = malloc(ulSize); /* allocate space for keynames */
|
---|
| 310 | if(pDataK) {
|
---|
| 311 | /* get keynames */
|
---|
| 312 | if(PrfQueryProfileString(orig,(PSZ)pCurrentA,NULL,
|
---|
| 313 | "\0",pDataK,ulSize)) {
|
---|
| 314 | pCurrentK = pDataK;
|
---|
| 315 | /* step through keynames */
|
---|
| 316 | while (*pCurrentK) {
|
---|
| 317 | if(PrfQueryProfileSize(orig,pCurrentA,
|
---|
| 318 | pCurrentK,
|
---|
| 319 | (PULONG)&ulSize) &&
|
---|
| 320 | ulSize) {
|
---|
| 321 | pData = malloc(ulSize);
|
---|
| 322 | if(pData) {
|
---|
| 323 | /* get data */
|
---|
| 324 | if(PrfQueryProfileData(orig,pCurrentA,
|
---|
| 325 | pCurrentK,
|
---|
| 326 | pData,
|
---|
| 327 | (PULONG)&ulSize))
|
---|
| 328 | /* write data to new ini file */
|
---|
| 329 | PrfWriteProfileData(new,pCurrentA,
|
---|
| 330 | pCurrentK,pData,
|
---|
| 331 | ulSize);
|
---|
| 332 | free(pData); /* free data */
|
---|
| 333 | }
|
---|
| 334 | }
|
---|
| 335 | while(*pCurrentK) /* next keyname */
|
---|
| 336 | pCurrentK++;
|
---|
| 337 | pCurrentK++;
|
---|
| 338 | }
|
---|
| 339 | }
|
---|
| 340 | free(pDataK); /* free keynames */
|
---|
| 341 | }
|
---|
| 342 | }
|
---|
| 343 | while(*pCurrentA) /* next applname */
|
---|
| 344 | pCurrentA++;
|
---|
| 345 | pCurrentA++;
|
---|
| 346 | }
|
---|
| 347 | }
|
---|
| 348 | free(pDataA); /* free applnames */
|
---|
| 349 | }
|
---|
| 350 | }
|
---|
| 351 | PrfCloseProfile(new);
|
---|
| 352 | }
|
---|
| 353 | PrfCloseProfile(orig);
|
---|
| 354 | }
|
---|
| 355 | WinDestroyMsgQueue(hmq2);
|
---|
| 356 | }
|
---|
| 357 | WinTerminate(hab2);
|
---|
| 358 | }
|
---|
| 359 | free(prfp->pszUserName);
|
---|
| 360 | free(prfp->pszSysName);
|
---|
| 361 | free(prfp);
|
---|
| 362 | }
|
---|
| 363 | }
|
---|
| 364 |
|
---|
| 365 |
|
---|
| 366 | static BOOL EnumAppNames (HWND hwndList,HINI hini) {
|
---|
| 367 |
|
---|
| 368 | PVOID pData;
|
---|
| 369 | PBYTE pCurrent;
|
---|
| 370 | ULONG ulSize = 0L;
|
---|
| 371 |
|
---|
| 372 | WinSendMsg(hwndList,LM_DELETEALL,NULL,NULL);
|
---|
| 373 | if(PrfQueryProfileSize(hini,NULL,NULL,(PULONG)&ulSize) && ulSize) {
|
---|
| 374 | pData = malloc(ulSize);
|
---|
| 375 | if(!pData)
|
---|
| 376 | return TRUE;
|
---|
| 377 | if(PrfQueryProfileString(hini,NULL,NULL,"\0",pData,ulSize)) {
|
---|
| 378 | pCurrent = pData;
|
---|
| 379 | WinEnableWindowUpdate(hwndList,FALSE);
|
---|
| 380 | while (*pCurrent) {
|
---|
| 381 | WinSendMsg(hwndList,LM_INSERTITEM,MPFROMSHORT(LIT_SORTASCENDING),
|
---|
| 382 | MPFROMP(pCurrent));
|
---|
| 383 | while(*pCurrent)
|
---|
| 384 | pCurrent++;
|
---|
| 385 | pCurrent++;
|
---|
| 386 | }
|
---|
| 387 | WinSendMsg(hwndList,LM_SELECTITEM,MPFROMSHORT(0),MPFROMSHORT(TRUE));
|
---|
| 388 | WinEnableWindowUpdate(hwndList,TRUE);
|
---|
| 389 | }
|
---|
| 390 | free(pData);
|
---|
| 391 | return TRUE;
|
---|
| 392 | }
|
---|
| 393 | DosBeep(250,100);
|
---|
| 394 | return FALSE;
|
---|
| 395 | }
|
---|
| 396 |
|
---|
| 397 |
|
---|
| 398 | static CHAR * GetKeyData (HWND hwndList,HINI hini,PSZ pAppName,
|
---|
| 399 | PSZ pKeyName,PULONG datalen) {
|
---|
| 400 |
|
---|
| 401 | ULONG ulKeySize = 0L;
|
---|
| 402 | PVOID pKeyData = NULL;
|
---|
| 403 |
|
---|
| 404 | *datalen = 0L;
|
---|
| 405 | if(PrfQueryProfileSize(hini,pAppName,pKeyName,
|
---|
| 406 | (PULONG)&ulKeySize)) {
|
---|
| 407 | pKeyData = malloc(ulKeySize + 1L);
|
---|
| 408 | if(pKeyData) {
|
---|
| 409 | if(PrfQueryProfileData(hini,pAppName,pKeyName,
|
---|
| 410 | pKeyData,(PULONG)&ulKeySize)) {
|
---|
| 411 | HexDump(hwndList,pKeyData,ulKeySize);
|
---|
| 412 | {
|
---|
| 413 | CHAR s[81];
|
---|
| 414 |
|
---|
| 415 | sprintf(s,
|
---|
| 416 | GetPString(IDS_INIBYTESTEXT),
|
---|
| 417 | ulKeySize,
|
---|
| 418 | &"s"[ulKeySize == 1]);
|
---|
| 419 | WinSetDlgItemText(WinQueryWindow(hwndList,QW_PARENT),
|
---|
| 420 | INI_NUMDATA,
|
---|
| 421 | s);
|
---|
| 422 | }
|
---|
| 423 | *datalen = ulKeySize;
|
---|
| 424 | return (CHAR *)pKeyData;
|
---|
| 425 | }
|
---|
| 426 | }
|
---|
| 427 | }
|
---|
| 428 | DosBeep(250,100);
|
---|
| 429 | return NULL;
|
---|
| 430 | }
|
---|
| 431 |
|
---|
| 432 |
|
---|
| 433 | static BOOL EnumKeyNames (HWND hwndList,HINI hini,PSZ pAppName) {
|
---|
| 434 |
|
---|
| 435 | PVOID pData;
|
---|
| 436 | PBYTE pCurrent;
|
---|
| 437 | ULONG ulSize = 0L;
|
---|
| 438 |
|
---|
| 439 | WinSendMsg(hwndList,LM_DELETEALL,NULL,NULL);
|
---|
| 440 | if(PrfQueryProfileSize(hini,pAppName,NULL,
|
---|
| 441 | (PULONG)&ulSize)) {
|
---|
| 442 | if(!ulSize) {
|
---|
| 443 | PrfWriteProfileData(hini,pAppName,NULL,"\0",0L);
|
---|
| 444 | return FALSE;
|
---|
| 445 | }
|
---|
| 446 | pData = malloc(ulSize + 1L);
|
---|
| 447 | if(pData) {
|
---|
| 448 | if(PrfQueryProfileString(hini,pAppName,NULL,
|
---|
| 449 | "\0",pData,ulSize)) {
|
---|
| 450 | pCurrent = pData;
|
---|
| 451 | WinEnableWindowUpdate(hwndList,FALSE);
|
---|
| 452 | while (*pCurrent) {
|
---|
| 453 | WinSendMsg(hwndList,LM_INSERTITEM,MPFROMSHORT(LIT_SORTASCENDING),
|
---|
| 454 | MPFROMP(pCurrent));
|
---|
| 455 | while(*pCurrent)
|
---|
| 456 | pCurrent++;
|
---|
| 457 | pCurrent++;
|
---|
| 458 | }
|
---|
| 459 | WinSendMsg(hwndList,LM_SELECTITEM,MPFROMSHORT(0),MPFROMSHORT(TRUE));
|
---|
| 460 | WinEnableWindowUpdate(hwndList,TRUE);
|
---|
| 461 | }
|
---|
| 462 | free(pData);
|
---|
| 463 | return TRUE;
|
---|
| 464 | }
|
---|
| 465 | }
|
---|
| 466 | DosBeep(250,100);
|
---|
| 467 | return FALSE;
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 |
|
---|
| 471 | #define hwndMLE WinWindowFromID(hwnd,IAF_MLE)
|
---|
| 472 |
|
---|
| 473 | MRESULT EXPENTRY FilterIniProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 474 |
|
---|
| 475 | INIDATA *inidata;
|
---|
| 476 | static CHAR lasttext[8192] = "";
|
---|
| 477 |
|
---|
| 478 | switch(msg) {
|
---|
| 479 | case WM_INITDLG:
|
---|
| 480 | WinSetWindowPtr(hwnd,0,mp2);
|
---|
| 481 | inidata = (INIDATA *)mp2;
|
---|
| 482 | WinSendDlgItemMsg(hwnd,IAF_SAVENAME,EM_SETTEXTLIMIT,
|
---|
| 483 | MPFROM2SHORT(CCHMAXPATH,0),MPVOID);
|
---|
| 484 | MLEsetformat(hwndMLE,MLFIE_NOTRANS);
|
---|
| 485 | MLEsetlimit(hwndMLE,8192);
|
---|
| 486 | WinSetWindowText(hwndMLE,lasttext);
|
---|
| 487 | {
|
---|
| 488 | FILEFINDBUF3 ffb;
|
---|
| 489 | ULONG nm;
|
---|
| 490 | HDIR hdir;
|
---|
| 491 |
|
---|
| 492 | hdir = HDIR_CREATE;
|
---|
| 493 | nm = 1L;
|
---|
| 494 | DosError(FERR_DISABLEHARDERR);
|
---|
| 495 | if(!DosFindFirst("*.IST",
|
---|
| 496 | &hdir,
|
---|
| 497 | FILE_NORMAL | FILE_ARCHIVED,
|
---|
| 498 | &ffb,
|
---|
| 499 | sizeof(ffb),
|
---|
| 500 | &nm,
|
---|
| 501 | FIL_STANDARD)) {
|
---|
| 502 | do {
|
---|
| 503 | priority_bumped();
|
---|
| 504 | WinSendDlgItemMsg(hwnd,IAF_LISTBOX,LM_INSERTITEM,
|
---|
| 505 | MPFROMSHORT(LIT_SORTASCENDING),
|
---|
| 506 | MPFROMP(ffb.achName));
|
---|
| 507 | nm = 1L;
|
---|
| 508 | } while(!DosFindNext(hdir,&ffb,sizeof(ffb),&nm));
|
---|
| 509 | DosFindClose(hdir);
|
---|
| 510 | priority_bumped();
|
---|
| 511 | }
|
---|
| 512 | }
|
---|
| 513 | break;
|
---|
| 514 |
|
---|
| 515 | case WM_ADJUSTWINDOWPOS:
|
---|
| 516 | PostMsg(hwnd,UM_SETDIR,MPVOID,MPVOID);
|
---|
| 517 | break;
|
---|
| 518 |
|
---|
| 519 | case UM_SETDIR:
|
---|
| 520 | PaintRecessedWindow(WinWindowFromID(hwnd,IAF_HELP),(HPS)0,FALSE,TRUE);
|
---|
| 521 | PaintRecessedWindow(WinWindowFromID(hwnd,IAF_SAVENAME),(HPS)0,FALSE,FALSE);
|
---|
| 522 | PaintRecessedWindow(WinWindowFromID(hwnd,IAF_LISTBOX),(HPS)0,FALSE,FALSE);
|
---|
| 523 | PaintRecessedWindow(WinWindowFromID(hwnd,IAF_MLE),(HPS)0,FALSE,FALSE);
|
---|
| 524 | return 0;
|
---|
| 525 |
|
---|
| 526 | case WM_CONTROL:
|
---|
| 527 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 528 | case IAF_SAVENAME:
|
---|
| 529 | if(SHORT2FROMMP(mp1) == EN_KILLFOCUS)
|
---|
| 530 | WinSetDlgItemText(hwnd,
|
---|
| 531 | IAF_HELP,
|
---|
| 532 | NullStr);
|
---|
| 533 | if(SHORT2FROMMP(mp1) == EN_SETFOCUS)
|
---|
| 534 | WinSetDlgItemText(hwnd,
|
---|
| 535 | IAF_HELP,
|
---|
| 536 | GetPString(IDS_MASKLISTNAMEHELPTEXT));
|
---|
| 537 | break;
|
---|
| 538 |
|
---|
| 539 | case IAF_LISTBOX:
|
---|
| 540 | if(SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
| 541 | WinSetDlgItemText(hwnd,
|
---|
| 542 | IAF_HELP,
|
---|
| 543 | NullStr);
|
---|
| 544 | if(SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
| 545 | WinSetDlgItemText(hwnd,
|
---|
| 546 | IAF_HELP,
|
---|
| 547 | GetPString(IDS_MASKLISTFILESHELPTEXT));
|
---|
| 548 | else if(SHORT2FROMMP(mp1) == LN_ENTER)
|
---|
| 549 | PostMsg(hwnd,
|
---|
| 550 | WM_COMMAND,
|
---|
| 551 | MPFROM2SHORT(IAF_LOAD,0),
|
---|
| 552 | MPVOID);
|
---|
| 553 | break;
|
---|
| 554 |
|
---|
| 555 | case IAF_MLE:
|
---|
| 556 | if(SHORT2FROMMP(mp1) == MLN_KILLFOCUS)
|
---|
| 557 | WinSetDlgItemText(hwnd,
|
---|
| 558 | IAF_HELP,
|
---|
| 559 | NullStr);
|
---|
| 560 | if(SHORT2FROMMP(mp1) == MLN_SETFOCUS)
|
---|
| 561 | WinSetDlgItemText(hwnd,
|
---|
| 562 | IAF_HELP,
|
---|
| 563 | GetPString(IDS_MASKLISTMASKSHELPTEXT));
|
---|
| 564 | break;
|
---|
| 565 | }
|
---|
| 566 | return 0;
|
---|
| 567 |
|
---|
| 568 | case WM_COMMAND:
|
---|
| 569 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 570 | case DID_OK:
|
---|
| 571 | inidata = INSTDATA(hwnd);
|
---|
| 572 | if(inidata) {
|
---|
| 573 |
|
---|
| 574 | CHAR s[8193],app[1024];
|
---|
| 575 | register CHAR *p;
|
---|
| 576 | SHORT sSelect,numitems;
|
---|
| 577 | BOOL match;
|
---|
| 578 |
|
---|
| 579 | *s = 0;
|
---|
| 580 | WinQueryWindowText(hwndMLE,8192,s);
|
---|
| 581 | if(*s) {
|
---|
| 582 | strcpy(lasttext,s);
|
---|
| 583 | p = s;
|
---|
| 584 | while(*p) {
|
---|
| 585 | if(*p == '\r') {
|
---|
| 586 | memmove(p,p + 1,strlen(p));
|
---|
| 587 | continue;
|
---|
| 588 | }
|
---|
| 589 | if(*p == '\n')
|
---|
| 590 | *p = 0;
|
---|
| 591 | p++;
|
---|
| 592 | }
|
---|
| 593 | p++;
|
---|
| 594 | *p = 0;
|
---|
| 595 | }
|
---|
| 596 | else {
|
---|
| 597 | DosBeep(250,100);
|
---|
| 598 | break;
|
---|
| 599 | }
|
---|
| 600 | numitems = (SHORT)WinSendMsg(inidata->hwndApp,
|
---|
| 601 | LM_QUERYITEMCOUNT,
|
---|
| 602 | MPVOID,
|
---|
| 603 | MPVOID);
|
---|
| 604 | if(numitems) {
|
---|
| 605 | WinSetPointer(HWND_DESKTOP,hptrBusy);
|
---|
| 606 | WinSetDlgItemText(hwnd,
|
---|
| 607 | IAF_HELP,
|
---|
| 608 | GetPString(IDS_FILTERINGTEXT));
|
---|
| 609 | sSelect = 0;
|
---|
| 610 | while(numitems) {
|
---|
| 611 | *app = 0;
|
---|
| 612 | WinSendMsg(inidata->hwndApp,
|
---|
| 613 | LM_QUERYITEMTEXT,
|
---|
| 614 | MPFROM2SHORT(sSelect,1024),
|
---|
| 615 | MPFROMP(app));
|
---|
| 616 | match = FALSE;
|
---|
| 617 | if(*app) {
|
---|
| 618 | p = s;
|
---|
| 619 | while(*p) {
|
---|
| 620 | if(*p != '/') {
|
---|
| 621 | if(wildcard(app,p,TRUE))
|
---|
| 622 | match = TRUE;
|
---|
| 623 | }
|
---|
| 624 | else if(wildcard(app,p + 1,TRUE)) {
|
---|
| 625 | match = FALSE;
|
---|
| 626 | break;
|
---|
| 627 | }
|
---|
| 628 | while(*p)
|
---|
| 629 | p++;
|
---|
| 630 | p++;
|
---|
| 631 | }
|
---|
| 632 | }
|
---|
| 633 | if(!match)
|
---|
| 634 | WinSendMsg(inidata->hwndApp,LM_DELETEITEM,
|
---|
| 635 | MPFROMSHORT(sSelect),MPVOID);
|
---|
| 636 | else
|
---|
| 637 | sSelect++;
|
---|
| 638 | numitems--;
|
---|
| 639 | }
|
---|
| 640 | WinSetPointer(HWND_DESKTOP,hptrArrow);
|
---|
| 641 | }
|
---|
| 642 | else {
|
---|
| 643 | DosBeep(250,100);
|
---|
| 644 | break;
|
---|
| 645 | }
|
---|
| 646 | }
|
---|
| 647 | WinDismissDlg(hwnd,1);
|
---|
| 648 | break;
|
---|
| 649 |
|
---|
| 650 | case IAF_LOAD:
|
---|
| 651 | {
|
---|
| 652 | CHAR s[8193];
|
---|
| 653 | FILE *fp;
|
---|
| 654 | INT len;
|
---|
| 655 | SHORT sSelect;
|
---|
| 656 |
|
---|
| 657 | sSelect = (SHORT)WinSendDlgItemMsg(hwnd,IAF_LISTBOX,
|
---|
| 658 | LM_QUERYSELECTION,
|
---|
| 659 | MPFROM2SHORT(LIT_FIRST,0),
|
---|
| 660 | MPVOID);
|
---|
| 661 | if(sSelect >= 0) {
|
---|
| 662 | *s = 0;
|
---|
| 663 | WinSendDlgItemMsg(hwnd,IAF_LISTBOX,LM_QUERYITEMTEXT,
|
---|
| 664 | MPFROM2SHORT(sSelect,CCHMAXPATH),
|
---|
| 665 | MPFROMP(s));
|
---|
| 666 | lstrip(rstrip(s));
|
---|
| 667 | if(*s) {
|
---|
| 668 | fp = _fsopen(s,"r",SH_DENYWR);
|
---|
| 669 | if(fp) {
|
---|
| 670 | len = fread(s,1,8192,fp);
|
---|
| 671 | s[len] = 0;
|
---|
| 672 | WinSetWindowText(hwndMLE,s);
|
---|
| 673 | fclose(fp);
|
---|
| 674 | }
|
---|
| 675 | else
|
---|
| 676 | DosBeep(250,100);
|
---|
| 677 | }
|
---|
| 678 | }
|
---|
| 679 | else
|
---|
| 680 | DosBeep(50,100);
|
---|
| 681 | }
|
---|
| 682 | break;
|
---|
| 683 |
|
---|
| 684 | case IAF_SAVE:
|
---|
| 685 | {
|
---|
| 686 | CHAR s[8193],filename[CCHMAXPATH],*p;
|
---|
| 687 | FILE *fp;
|
---|
| 688 |
|
---|
| 689 | *filename = 0;
|
---|
| 690 | WinQueryDlgItemText(hwnd,
|
---|
| 691 | IAF_SAVENAME,
|
---|
| 692 | CCHMAXPATH,
|
---|
| 693 | filename);
|
---|
| 694 | lstrip(rstrip(filename));
|
---|
| 695 | if(*filename) {
|
---|
| 696 | p = strchr(filename,'.');
|
---|
| 697 | if(p) {
|
---|
| 698 | strcpy(p,".IST");
|
---|
| 699 | WinSetDlgItemText(hwnd,
|
---|
| 700 | IAF_SAVENAME,
|
---|
| 701 | filename);
|
---|
| 702 | }
|
---|
| 703 | *s = 0;
|
---|
| 704 | WinQueryWindowText(hwndMLE,8192,s);
|
---|
| 705 | if(*s) {
|
---|
| 706 | fp = fopen(filename,"w");
|
---|
| 707 | if(fp) {
|
---|
| 708 | fwrite(s,1,strlen(s),fp);
|
---|
| 709 | fclose(fp);
|
---|
| 710 | WinSendDlgItemMsg(hwnd,
|
---|
| 711 | IAF_LISTBOX,
|
---|
| 712 | LM_INSERTITEM,
|
---|
| 713 | MPFROMSHORT(LIT_SORTASCENDING),
|
---|
| 714 | MPFROMP(filename));
|
---|
| 715 | }
|
---|
| 716 | else
|
---|
| 717 | DosBeep(250,100);
|
---|
| 718 | }
|
---|
| 719 | else
|
---|
| 720 | DosBeep(50,100);
|
---|
| 721 | }
|
---|
| 722 | }
|
---|
| 723 | break;
|
---|
| 724 |
|
---|
| 725 | case IAF_DELETE:
|
---|
| 726 | {
|
---|
| 727 | CHAR s[CCHMAXPATH];
|
---|
| 728 | SHORT sSelect;
|
---|
| 729 |
|
---|
| 730 | sSelect = (SHORT)WinSendDlgItemMsg(hwnd,IAF_LISTBOX,
|
---|
| 731 | LM_QUERYSELECTION,
|
---|
| 732 | MPFROM2SHORT(LIT_FIRST,0),
|
---|
| 733 | MPVOID);
|
---|
| 734 | if(sSelect >= 0) {
|
---|
| 735 | *s = 0;
|
---|
| 736 | WinSendDlgItemMsg(hwnd,IAF_LISTBOX,LM_QUERYITEMTEXT,
|
---|
| 737 | MPFROM2SHORT(sSelect,CCHMAXPATH),
|
---|
| 738 | MPFROMP(s));
|
---|
| 739 | lstrip(rstrip(s));
|
---|
| 740 | if(*s) {
|
---|
| 741 | unlinkf(s);
|
---|
| 742 | WinSendDlgItemMsg(hwnd,IAF_LISTBOX,LM_DELETEITEM,
|
---|
| 743 | MPFROMSHORT(sSelect),MPVOID);
|
---|
| 744 | }
|
---|
| 745 | }
|
---|
| 746 | }
|
---|
| 747 | break;
|
---|
| 748 |
|
---|
| 749 | case DID_CANCEL:
|
---|
| 750 | WinDismissDlg(hwnd,0);
|
---|
| 751 | break;
|
---|
| 752 |
|
---|
| 753 | case IDM_HELP:
|
---|
| 754 | if(hwndHelp)
|
---|
| 755 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 756 | MPFROM2SHORT(HELP_FILTERINI,0),
|
---|
| 757 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 758 | break;
|
---|
| 759 | }
|
---|
| 760 | return 0;
|
---|
| 761 | }
|
---|
| 762 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
| 763 | }
|
---|
| 764 |
|
---|
| 765 |
|
---|
| 766 | MRESULT EXPENTRY IntraIniProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 767 |
|
---|
| 768 | INIREC *inirec;
|
---|
| 769 |
|
---|
| 770 | switch(msg) {
|
---|
| 771 | case WM_INITDLG:
|
---|
| 772 | WinSetWindowPtr(hwnd,0,mp2);
|
---|
| 773 | inirec = (INIREC *)mp2;
|
---|
| 774 | WinSendDlgItemMsg(hwnd,
|
---|
| 775 | INII_NEWAPP,
|
---|
| 776 | EM_SETTEXTLIMIT,
|
---|
| 777 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 778 | MPVOID);
|
---|
| 779 | WinSendDlgItemMsg(hwnd,
|
---|
| 780 | INII_NEWKEY,
|
---|
| 781 | EM_SETTEXTLIMIT,
|
---|
| 782 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 783 | MPVOID);
|
---|
| 784 | {
|
---|
| 785 | CHAR s[CCHMAXPATH + 34];
|
---|
| 786 |
|
---|
| 787 | sprintf(s,
|
---|
| 788 | GetPString(IDS_INIWASTEXT),
|
---|
| 789 | inirec->app);
|
---|
| 790 | WinSetDlgItemText(hwnd,
|
---|
| 791 | INII_OLDAPP,
|
---|
| 792 | s);
|
---|
| 793 | }
|
---|
| 794 | if(!*inirec->key) {
|
---|
| 795 | WinEnableWindow(WinWindowFromID(hwnd,INII_NEWKEY),FALSE);
|
---|
| 796 | WinEnableWindow(WinWindowFromID(hwnd,INII_NEWKEYHDR),FALSE);
|
---|
| 797 | switch(inirec->action) {
|
---|
| 798 | case IDM_MOVE:
|
---|
| 799 | WinSetWindowText(hwnd,
|
---|
| 800 | GetPString(IDS_INIRENAMEAPPTITLETEXT));
|
---|
| 801 | break;
|
---|
| 802 | case IDM_COPY:
|
---|
| 803 | WinSetWindowText(hwnd,
|
---|
| 804 | GetPString(IDS_INICOPYAPPTITLETEXT));
|
---|
| 805 | break;
|
---|
| 806 | }
|
---|
| 807 | }
|
---|
| 808 | else {
|
---|
| 809 | {
|
---|
| 810 | CHAR s[CCHMAXPATH + 34];
|
---|
| 811 |
|
---|
| 812 | sprintf(s,
|
---|
| 813 | GetPString(IDS_INIWASTEXT),
|
---|
| 814 | inirec->key);
|
---|
| 815 | WinSetDlgItemText(hwnd,
|
---|
| 816 | INII_OLDKEY,
|
---|
| 817 | s);
|
---|
| 818 | }
|
---|
| 819 | WinSetDlgItemText(hwnd,
|
---|
| 820 | INII_NEWAPP,
|
---|
| 821 | inirec->app);
|
---|
| 822 | WinSendDlgItemMsg(hwnd,
|
---|
| 823 | INII_NEWAPP,
|
---|
| 824 | EM_SETSEL,
|
---|
| 825 | MPFROM2SHORT(0,CCHMAXPATH),
|
---|
| 826 | MPVOID);
|
---|
| 827 | switch(inirec->action) {
|
---|
| 828 | case IDM_MOVE:
|
---|
| 829 | WinSetWindowText(hwnd,
|
---|
| 830 | GetPString(IDS_INIRENAMEKEYTITLETEXT));
|
---|
| 831 | break;
|
---|
| 832 | case IDM_COPY:
|
---|
| 833 | WinSetWindowText(hwnd,
|
---|
| 834 | GetPString(IDS_INICOPYKEYTITLETEXT));
|
---|
| 835 | break;
|
---|
| 836 | }
|
---|
| 837 | }
|
---|
| 838 | break;
|
---|
| 839 |
|
---|
| 840 | case WM_COMMAND:
|
---|
| 841 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 842 | case DID_OK:
|
---|
| 843 | inirec = (INIREC *)WinQueryWindowPtr(hwnd,0);
|
---|
| 844 | if(inirec) {
|
---|
| 845 | WinQueryDlgItemText(hwnd,
|
---|
| 846 | INII_NEWAPP,
|
---|
| 847 | CCHMAXPATH,
|
---|
| 848 | inirec->app2);
|
---|
| 849 | lstrip(rstrip(inirec->app2));
|
---|
| 850 | if(!*inirec->app2) {
|
---|
| 851 | DosBeep(50,100);
|
---|
| 852 | break;
|
---|
| 853 | }
|
---|
| 854 | if(*inirec->key) {
|
---|
| 855 | WinQueryDlgItemText(hwnd,
|
---|
| 856 | INII_NEWKEY,
|
---|
| 857 | CCHMAXPATH,
|
---|
| 858 | inirec->key2);
|
---|
| 859 | lstrip(rstrip(inirec->key2));
|
---|
| 860 | if(!*inirec->key2) {
|
---|
| 861 | DosBeep(50,100);
|
---|
| 862 | break;
|
---|
| 863 | }
|
---|
| 864 | }
|
---|
| 865 | WinDismissDlg(hwnd,1);
|
---|
| 866 | }
|
---|
| 867 | break;
|
---|
| 868 |
|
---|
| 869 | case DID_CANCEL:
|
---|
| 870 | WinDismissDlg(hwnd,0);
|
---|
| 871 | break;
|
---|
| 872 |
|
---|
| 873 | case IDM_HELP:
|
---|
| 874 | if(hwndHelp)
|
---|
| 875 | WinSendMsg(hwndHelp,
|
---|
| 876 | HM_DISPLAY_HELP,
|
---|
| 877 | MPFROM2SHORT(HELP_INTRAINI,0),
|
---|
| 878 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 879 | break;
|
---|
| 880 | }
|
---|
| 881 | return 0;
|
---|
| 882 | }
|
---|
| 883 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
| 884 | }
|
---|
| 885 |
|
---|
| 886 |
|
---|
| 887 | MRESULT EXPENTRY ChangeIniProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 888 |
|
---|
| 889 | switch(msg) {
|
---|
| 890 | case WM_INITDLG:
|
---|
| 891 | WinSetWindowPtr(hwnd,0,mp2);
|
---|
| 892 | WinSendDlgItemMsg(hwnd,INIR_USERPROFILE,EM_SETTEXTLIMIT,
|
---|
| 893 | MPFROM2SHORT(CCHMAXPATH,0),MPVOID);
|
---|
| 894 | WinSendDlgItemMsg(hwnd,INIR_SYSTEMPROFILE,EM_SETTEXTLIMIT,
|
---|
| 895 | MPFROM2SHORT(CCHMAXPATH,0),MPVOID);
|
---|
| 896 | break;
|
---|
| 897 |
|
---|
| 898 | case WM_COMMAND:
|
---|
| 899 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 900 | case INIR_FIND:
|
---|
| 901 | {
|
---|
| 902 | CHAR filename[CCHMAXPATH],*p,*ininame;
|
---|
| 903 | USHORT id = 0;
|
---|
| 904 | HWND hwndFocus;
|
---|
| 905 |
|
---|
| 906 | hwndFocus = WinQueryFocus(HWND_DESKTOP);
|
---|
| 907 | if(hwndFocus)
|
---|
| 908 | id = WinQueryWindowUShort(hwndFocus,QWS_ID);
|
---|
| 909 | if(id != INIR_SYSTEMPROFILE)
|
---|
| 910 | id = INIR_USERPROFILE;
|
---|
| 911 | ininame = INSTDATA(hwnd);
|
---|
| 912 | if(ininame && *ininame) {
|
---|
| 913 | strcpy(filename,ininame);
|
---|
| 914 | p = filename;
|
---|
| 915 | while(*p) {
|
---|
| 916 | if(*p == '/')
|
---|
| 917 | *p = '\\';
|
---|
| 918 | p++;
|
---|
| 919 | }
|
---|
| 920 | p = strrchr(filename,'\\');
|
---|
| 921 | if(p) {
|
---|
| 922 | p++;
|
---|
| 923 | *p = 0;
|
---|
| 924 | }
|
---|
| 925 | else
|
---|
| 926 | *filename = 0;
|
---|
| 927 | }
|
---|
| 928 | else
|
---|
| 929 | *filename = 0;
|
---|
| 930 | strcat(filename,"*.INI");
|
---|
| 931 | if(insert_filename(hwnd,
|
---|
| 932 | filename,
|
---|
| 933 | TRUE,
|
---|
| 934 | FALSE) &&
|
---|
| 935 | *filename)
|
---|
| 936 | WinSetDlgItemText(hwnd,
|
---|
| 937 | id,
|
---|
| 938 | filename);
|
---|
| 939 | }
|
---|
| 940 | break;
|
---|
| 941 |
|
---|
| 942 | case DID_OK:
|
---|
| 943 | {
|
---|
| 944 | HINI testini;
|
---|
| 945 | PRFPROFILE prfp;
|
---|
| 946 | CHAR sysini[CCHMAXPATH];
|
---|
| 947 | CHAR userini[CCHMAXPATH];
|
---|
| 948 |
|
---|
| 949 | WinQueryDlgItemText(hwnd,INIR_USERPROFILE,CCHMAXPATH,userini);
|
---|
| 950 | WinQueryDlgItemText(hwnd,INIR_SYSTEMPROFILE,CCHMAXPATH,sysini);
|
---|
| 951 | testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),userini);
|
---|
| 952 | if(!testini) {
|
---|
| 953 | saymsg(MB_CANCEL,
|
---|
| 954 | hwnd,
|
---|
| 955 | GetPString(IDS_ERRORTEXT),
|
---|
| 956 | GetPString(IDS_INICANTOPENUSERTEXT),
|
---|
| 957 | userini);
|
---|
| 958 | break;
|
---|
| 959 | }
|
---|
| 960 | PrfCloseProfile(testini);
|
---|
| 961 | testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),sysini);
|
---|
| 962 | if(!testini) {
|
---|
| 963 | saymsg(MB_CANCEL,
|
---|
| 964 | hwnd,
|
---|
| 965 | GetPString(IDS_ERRORTEXT),
|
---|
| 966 | GetPString(IDS_INICANTOPENSYSTEXT),
|
---|
| 967 | sysini);
|
---|
| 968 | break;
|
---|
| 969 | }
|
---|
| 970 | PrfCloseProfile(testini);
|
---|
| 971 | memset(&prfp,0,sizeof(PRFPROFILE));
|
---|
| 972 | prfp.cchUserName = strlen(sysini);
|
---|
| 973 | prfp.cchSysName = strlen(userini);
|
---|
| 974 | prfp.pszUserName = (PSZ)userini;
|
---|
| 975 | prfp.pszSysName = (PSZ)sysini;
|
---|
| 976 | if(PrfReset(WinQueryAnchorBlock(hwnd),&prfp))
|
---|
| 977 | WinDismissDlg(hwnd,1);
|
---|
| 978 | else
|
---|
| 979 | General_Error(WinQueryAnchorBlock(hwnd),
|
---|
| 980 | hwnd,
|
---|
| 981 | __FILE__,
|
---|
| 982 | __LINE__,
|
---|
| 983 | GetPString(IDS_INIPRFRESETFAILEDTEXT));
|
---|
| 984 | }
|
---|
| 985 | break;
|
---|
| 986 |
|
---|
| 987 | case DID_CANCEL:
|
---|
| 988 | WinDismissDlg(hwnd,0);
|
---|
| 989 | break;
|
---|
| 990 |
|
---|
| 991 | case IDM_HELP:
|
---|
| 992 | if(hwndHelp)
|
---|
| 993 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 994 | MPFROM2SHORT(HELP_CHANGEINI,0),
|
---|
| 995 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 996 | break;
|
---|
| 997 | }
|
---|
| 998 | return 0;
|
---|
| 999 | }
|
---|
| 1000 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
| 1001 | }
|
---|
| 1002 |
|
---|
| 1003 |
|
---|
| 1004 | MRESULT EXPENTRY SwapIniProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1005 |
|
---|
| 1006 | switch(msg) {
|
---|
| 1007 | case WM_INITDLG:
|
---|
| 1008 | WinSetWindowPtr(hwnd,0,mp2);
|
---|
| 1009 | WinSendDlgItemMsg(hwnd,
|
---|
| 1010 | INIR_USERPROFILE,
|
---|
| 1011 | EM_SETTEXTLIMIT,
|
---|
| 1012 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 1013 | MPVOID);
|
---|
| 1014 | WinSendDlgItemMsg(hwnd,
|
---|
| 1015 | INIR_SYSTEMPROFILE,
|
---|
| 1016 | EM_SETTEXTLIMIT,
|
---|
| 1017 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 1018 | MPVOID);
|
---|
| 1019 | WinSetWindowText(hwnd,
|
---|
| 1020 | GetPString(IDS_INISWAPOS2INISTITLETEXT));
|
---|
| 1021 | break;
|
---|
| 1022 |
|
---|
| 1023 | case WM_COMMAND:
|
---|
| 1024 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 1025 | case INIR_FIND:
|
---|
| 1026 | {
|
---|
| 1027 | CHAR filename[CCHMAXPATH],*p,*ininame;
|
---|
| 1028 | USHORT id = 0;
|
---|
| 1029 | HWND hwndFocus;
|
---|
| 1030 |
|
---|
| 1031 | hwndFocus = WinQueryFocus(HWND_DESKTOP);
|
---|
| 1032 | if(hwndFocus)
|
---|
| 1033 | id = WinQueryWindowUShort(hwndFocus,QWS_ID);
|
---|
| 1034 | if(id != INIR_SYSTEMPROFILE)
|
---|
| 1035 | id = INIR_USERPROFILE;
|
---|
| 1036 | ininame = INSTDATA(hwnd);
|
---|
| 1037 | if(ininame && *ininame) {
|
---|
| 1038 | strcpy(filename,ininame);
|
---|
| 1039 | p = filename;
|
---|
| 1040 | while(*p) {
|
---|
| 1041 | if(*p == '/')
|
---|
| 1042 | *p = '\\';
|
---|
| 1043 | p++;
|
---|
| 1044 | }
|
---|
| 1045 | p = strrchr(filename,'\\');
|
---|
| 1046 | if(p) {
|
---|
| 1047 | p++;
|
---|
| 1048 | *p = 0;
|
---|
| 1049 | }
|
---|
| 1050 | else
|
---|
| 1051 | *filename = 0;
|
---|
| 1052 | }
|
---|
| 1053 | else
|
---|
| 1054 | *filename = 0;
|
---|
| 1055 | strcat(filename,"*.INI");
|
---|
| 1056 | if(insert_filename(hwnd,
|
---|
| 1057 | filename,
|
---|
| 1058 | TRUE,
|
---|
| 1059 | FALSE) &&
|
---|
| 1060 | *filename)
|
---|
| 1061 | WinSetDlgItemText(hwnd,
|
---|
| 1062 | id,
|
---|
| 1063 | filename);
|
---|
| 1064 | }
|
---|
| 1065 | break;
|
---|
| 1066 |
|
---|
| 1067 | case DID_OK:
|
---|
| 1068 | {
|
---|
| 1069 | HINI testini;
|
---|
| 1070 | PRFPROFILE prfp;
|
---|
| 1071 | CHAR sysini[CCHMAXPATH];
|
---|
| 1072 | CHAR userini[CCHMAXPATH];
|
---|
| 1073 | CHAR oldsysini[CCHMAXPATH];
|
---|
| 1074 | CHAR olduserini[CCHMAXPATH];
|
---|
| 1075 | CHAR tempsysini[CCHMAXPATH];
|
---|
| 1076 | CHAR tempuserini[CCHMAXPATH];
|
---|
| 1077 | CHAR tempsysini2[CCHMAXPATH];
|
---|
| 1078 | CHAR tempuserini2[CCHMAXPATH];
|
---|
| 1079 | CHAR *p;
|
---|
| 1080 | APIRET rc;
|
---|
| 1081 |
|
---|
| 1082 | *tempuserini = 0;
|
---|
| 1083 | *tempsysini = 0;
|
---|
| 1084 | *tempuserini2 = 0;
|
---|
| 1085 | *tempsysini2 = 0;
|
---|
| 1086 | memset(&prfp,0,sizeof(PRFPROFILE));
|
---|
| 1087 | prfp.cchUserName = CCHMAXPATH;
|
---|
| 1088 | prfp.cchSysName = CCHMAXPATH;
|
---|
| 1089 | prfp.pszUserName = (PSZ)olduserini;
|
---|
| 1090 | prfp.pszSysName = (PSZ)oldsysini;
|
---|
| 1091 | if(!PrfQueryProfile(WinQueryAnchorBlock(hwnd),&prfp)) {
|
---|
| 1092 | General_Error(WinQueryAnchorBlock(hwnd),
|
---|
| 1093 | hwnd,
|
---|
| 1094 | __FILE__,
|
---|
| 1095 | __LINE__,
|
---|
| 1096 | GetPString(IDS_INIQUERYPRFFAILEDTEXT));
|
---|
| 1097 | break;
|
---|
| 1098 | }
|
---|
| 1099 | WinQueryDlgItemText(hwnd,
|
---|
| 1100 | INIR_USERPROFILE,
|
---|
| 1101 | CCHMAXPATH,
|
---|
| 1102 | userini);
|
---|
| 1103 | WinQueryDlgItemText(hwnd,
|
---|
| 1104 | INIR_SYSTEMPROFILE,
|
---|
| 1105 | CCHMAXPATH,
|
---|
| 1106 | sysini);
|
---|
| 1107 | MakeFullName(userini);
|
---|
| 1108 | MakeFullName(sysini);
|
---|
| 1109 | testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),
|
---|
| 1110 | userini);
|
---|
| 1111 | if(!testini) {
|
---|
| 1112 | saymsg(MB_CANCEL,
|
---|
| 1113 | hwnd,
|
---|
| 1114 | GetPString(IDS_ERRORTEXT),
|
---|
| 1115 | GetPString(IDS_INICANTOPENUSERTEXT),
|
---|
| 1116 | userini);
|
---|
| 1117 | break;
|
---|
| 1118 | }
|
---|
| 1119 | PrfCloseProfile(testini);
|
---|
| 1120 | testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),sysini);
|
---|
| 1121 | if(!testini) {
|
---|
| 1122 | saymsg(MB_CANCEL,
|
---|
| 1123 | hwnd,
|
---|
| 1124 | GetPString(IDS_ERRORTEXT),
|
---|
| 1125 | GetPString(IDS_INICANTOPENSYSTEXT),
|
---|
| 1126 | sysini);
|
---|
| 1127 | break;
|
---|
| 1128 | }
|
---|
| 1129 | PrfCloseProfile(testini);
|
---|
| 1130 | /* make copies of new inis */
|
---|
| 1131 | *tempuserini = 0;
|
---|
| 1132 | *tempsysini = 0;
|
---|
| 1133 | save_dir2(tempuserini);
|
---|
| 1134 | if(tempuserini[strlen(tempuserini) - 1] != '\\')
|
---|
| 1135 | strcat(tempuserini,"\\");
|
---|
| 1136 | strcat(tempuserini,"TEMPUSER.INI");
|
---|
| 1137 | rc = DosCopy(userini,tempuserini,DCPY_EXISTING);
|
---|
| 1138 | if(rc) {
|
---|
| 1139 | Dos_Error(MB_CANCEL,
|
---|
| 1140 | rc,
|
---|
| 1141 | hwnd,
|
---|
| 1142 | __FILE__,
|
---|
| 1143 | __LINE__,
|
---|
| 1144 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
| 1145 | userini,
|
---|
| 1146 | tempuserini);
|
---|
| 1147 | break;
|
---|
| 1148 | }
|
---|
| 1149 | save_dir2(tempsysini);
|
---|
| 1150 | if(tempsysini[strlen(tempsysini) - 1] != '\\')
|
---|
| 1151 | strcat(tempsysini,"\\");
|
---|
| 1152 | strcat(tempsysini,"TEMPSYS.INI");
|
---|
| 1153 | rc = DosCopy(sysini,
|
---|
| 1154 | tempsysini,
|
---|
| 1155 | DCPY_EXISTING);
|
---|
| 1156 | if(rc) {
|
---|
| 1157 | Dos_Error(MB_CANCEL,
|
---|
| 1158 | rc,
|
---|
| 1159 | hwnd,
|
---|
| 1160 | __FILE__,
|
---|
| 1161 | __LINE__,
|
---|
| 1162 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
| 1163 | sysini,
|
---|
| 1164 | tempsysini);
|
---|
| 1165 | break;
|
---|
| 1166 | }
|
---|
| 1167 | memset(&prfp,0,sizeof(PRFPROFILE));
|
---|
| 1168 | prfp.cchUserName = strlen(tempuserini);
|
---|
| 1169 | prfp.cchSysName = strlen(tempsysini);
|
---|
| 1170 | prfp.pszUserName = (PSZ)tempuserini;
|
---|
| 1171 | prfp.pszSysName = (PSZ)tempsysini;
|
---|
| 1172 | if(PrfReset(WinQueryAnchorBlock(hwnd),&prfp)) {
|
---|
| 1173 | /* backup old inis */
|
---|
| 1174 | strcpy(tempuserini2,olduserini);
|
---|
| 1175 | p = strrchr(tempuserini2,'\\');
|
---|
| 1176 | if(!p)
|
---|
| 1177 | *tempuserini2 = 0;
|
---|
| 1178 | else {
|
---|
| 1179 | p++;
|
---|
| 1180 | *p = 0;
|
---|
| 1181 | }
|
---|
| 1182 | strcat(tempuserini2,"OS2INI.BAK");
|
---|
| 1183 | rc = DosCopy(olduserini,
|
---|
| 1184 | tempuserini2,
|
---|
| 1185 | DCPY_EXISTING);
|
---|
| 1186 | if(rc) {
|
---|
| 1187 | Dos_Error(MB_CANCEL,
|
---|
| 1188 | rc,
|
---|
| 1189 | hwnd,
|
---|
| 1190 | __FILE__,
|
---|
| 1191 | __LINE__,
|
---|
| 1192 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
| 1193 | olduserini,
|
---|
| 1194 | tempuserini2);
|
---|
| 1195 | WinDismissDlg(hwnd,1);
|
---|
| 1196 | break;
|
---|
| 1197 | }
|
---|
| 1198 | strcpy(tempsysini2,oldsysini);
|
---|
| 1199 | p = strrchr(tempsysini2,'\\');
|
---|
| 1200 | if(!p)
|
---|
| 1201 | *tempsysini2 = 0;
|
---|
| 1202 | else {
|
---|
| 1203 | p++;
|
---|
| 1204 | *p = 0;
|
---|
| 1205 | }
|
---|
| 1206 | strcat(tempsysini2,"OS2SYINI.BAK");
|
---|
| 1207 | rc = DosCopy(oldsysini,
|
---|
| 1208 | tempsysini2,
|
---|
| 1209 | DCPY_EXISTING);
|
---|
| 1210 | if(rc) {
|
---|
| 1211 | Dos_Error(MB_CANCEL,
|
---|
| 1212 | rc,
|
---|
| 1213 | hwnd,
|
---|
| 1214 | __FILE__,
|
---|
| 1215 | __LINE__,
|
---|
| 1216 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
| 1217 | oldsysini,
|
---|
| 1218 | tempsysini2);
|
---|
| 1219 | WinDismissDlg(hwnd,1);
|
---|
| 1220 | break;
|
---|
| 1221 | }
|
---|
| 1222 | /* copy new inis to old ini names */
|
---|
| 1223 | rc = DosCopy(userini,
|
---|
| 1224 | olduserini,
|
---|
| 1225 | DCPY_EXISTING);
|
---|
| 1226 | if(rc) {
|
---|
| 1227 | Dos_Error(MB_CANCEL,
|
---|
| 1228 | rc,
|
---|
| 1229 | hwnd,
|
---|
| 1230 | __FILE__,
|
---|
| 1231 | __LINE__,
|
---|
| 1232 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
| 1233 | userini,
|
---|
| 1234 | olduserini);
|
---|
| 1235 | WinDismissDlg(hwnd,1);
|
---|
| 1236 | break;
|
---|
| 1237 | }
|
---|
| 1238 | rc = DosCopy(sysini,
|
---|
| 1239 | oldsysini,
|
---|
| 1240 | DCPY_EXISTING);
|
---|
| 1241 | if(rc) {
|
---|
| 1242 | Dos_Error(MB_CANCEL,
|
---|
| 1243 | rc,
|
---|
| 1244 | hwnd,
|
---|
| 1245 | __FILE__,
|
---|
| 1246 | __LINE__,
|
---|
| 1247 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
| 1248 | userini,
|
---|
| 1249 | olduserini);
|
---|
| 1250 | WinDismissDlg(hwnd,1);
|
---|
| 1251 | break;
|
---|
| 1252 | }
|
---|
| 1253 | /* replace temp inis with new permanent inis */
|
---|
| 1254 | memset(&prfp,0,sizeof(PRFPROFILE));
|
---|
| 1255 | prfp.cchUserName = strlen(oldsysini);
|
---|
| 1256 | prfp.cchSysName = strlen(olduserini);
|
---|
| 1257 | prfp.pszUserName = (PSZ)olduserini;
|
---|
| 1258 | prfp.pszSysName = (PSZ)oldsysini;
|
---|
| 1259 | if(!PrfReset(WinQueryAnchorBlock(hwnd),&prfp))
|
---|
| 1260 | General_Error(WinQueryAnchorBlock(hwnd),
|
---|
| 1261 | hwnd,
|
---|
| 1262 | __FILE__,
|
---|
| 1263 | __LINE__,
|
---|
| 1264 | GetPString(IDS_INIPRFRESETFAILEDTEXT));
|
---|
| 1265 | else {
|
---|
| 1266 | Notify(GetPString(IDS_SUCCESSTEXT));
|
---|
| 1267 | unlinkf(tempuserini);
|
---|
| 1268 | unlinkf(tempsysini);
|
---|
| 1269 | }
|
---|
| 1270 | WinDismissDlg(hwnd,1);
|
---|
| 1271 | }
|
---|
| 1272 | else
|
---|
| 1273 | General_Error(WinQueryAnchorBlock(hwnd),
|
---|
| 1274 | hwnd,
|
---|
| 1275 | __FILE__,
|
---|
| 1276 | __LINE__,
|
---|
| 1277 | GetPString(IDS_INIPRFRESETFAILEDTEXT));
|
---|
| 1278 | }
|
---|
| 1279 | break;
|
---|
| 1280 |
|
---|
| 1281 | case DID_CANCEL:
|
---|
| 1282 | WinDismissDlg(hwnd,0);
|
---|
| 1283 | break;
|
---|
| 1284 |
|
---|
| 1285 | case IDM_HELP:
|
---|
| 1286 | if(hwndHelp)
|
---|
| 1287 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 1288 | MPFROM2SHORT(HELP_SWAPINI,0),
|
---|
| 1289 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 1290 | break;
|
---|
| 1291 | }
|
---|
| 1292 | return 0;
|
---|
| 1293 | }
|
---|
| 1294 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
| 1295 | }
|
---|
| 1296 |
|
---|
| 1297 |
|
---|
| 1298 | MRESULT EXPENTRY AddIniProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1299 |
|
---|
| 1300 | INIDATA *inidata;
|
---|
| 1301 |
|
---|
| 1302 | switch(msg) {
|
---|
| 1303 | case WM_INITDLG:
|
---|
| 1304 | if(!mp2) {
|
---|
| 1305 | WinDismissDlg(hwnd,0);
|
---|
| 1306 | break;
|
---|
| 1307 | }
|
---|
| 1308 | inidata = (INIDATA *)mp2;
|
---|
| 1309 | if(inidata->edit)
|
---|
| 1310 | WinSetWindowText(hwnd,
|
---|
| 1311 | GetPString(IDS_INIEDITINITITLETEXT));
|
---|
| 1312 | WinSetWindowPtr(hwnd,0,(PVOID)mp2);
|
---|
| 1313 | WinSendDlgItemMsg(hwnd,
|
---|
| 1314 | IAD_APPNAME,
|
---|
| 1315 | EM_SETTEXTLIMIT,
|
---|
| 1316 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 1317 | MPVOID);
|
---|
| 1318 | WinSendDlgItemMsg(hwnd,
|
---|
| 1319 | IAD_KEYNAME,
|
---|
| 1320 | EM_SETTEXTLIMIT,
|
---|
| 1321 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 1322 | MPVOID);
|
---|
| 1323 | WinSendDlgItemMsg(hwnd,
|
---|
| 1324 | IAD_DATA,
|
---|
| 1325 | EM_SETTEXTLIMIT,
|
---|
| 1326 | MPFROM2SHORT(32767,0),
|
---|
| 1327 | MPVOID);
|
---|
| 1328 | WinEnableWindow(WinWindowFromID(hwnd,DID_OK),
|
---|
| 1329 | FALSE);
|
---|
| 1330 | WinSetDlgItemText(hwnd,
|
---|
| 1331 | IAD_APPNAME,
|
---|
| 1332 | inidata->applname);
|
---|
| 1333 | if(inidata->edit) {
|
---|
| 1334 | WinSetDlgItemText(hwnd,
|
---|
| 1335 | IAD_KEYNAME,
|
---|
| 1336 | inidata->keyname);
|
---|
| 1337 | if(inidata->data && inidata->datalen) {
|
---|
| 1338 |
|
---|
| 1339 | CHAR *p;
|
---|
| 1340 |
|
---|
| 1341 | inidata->isbinary = FALSE;
|
---|
| 1342 | p = inidata->data;
|
---|
| 1343 | while((p - inidata->data) < inidata->datalen - 1) {
|
---|
| 1344 | if(*p < ' ' || !isprint(*p)) {
|
---|
| 1345 | inidata->isbinary = TRUE;
|
---|
| 1346 | break;
|
---|
| 1347 | }
|
---|
| 1348 | p++;
|
---|
| 1349 | }
|
---|
| 1350 | if(inidata->isbinary) {
|
---|
| 1351 | inidata->isbinary = TRUE;
|
---|
| 1352 | WinCheckButton(hwnd,IAD_ISBINARY,TRUE);
|
---|
| 1353 | if(saymsg(MB_ENTERCANCEL | MB_ICONEXCLAMATION,
|
---|
| 1354 | hwnd,
|
---|
| 1355 | GetPString(IDS_WARNINGTEXT),
|
---|
| 1356 | GetPString(IDS_INIBINARYDATASKIPTEXT)) ==
|
---|
| 1357 | MBID_CANCEL)
|
---|
| 1358 | WinDismissDlg(hwnd,0);
|
---|
| 1359 | p = malloc(inidata->datalen * 2);
|
---|
| 1360 | if(p) {
|
---|
| 1361 | memset(p,0,inidata->datalen * 2);
|
---|
| 1362 | fixup(inidata->data,p,inidata->datalen * 2,
|
---|
| 1363 | inidata->datalen);
|
---|
| 1364 | WinSetDlgItemText(hwnd,IAD_DATA,p);
|
---|
| 1365 | free(p);
|
---|
| 1366 | }
|
---|
| 1367 | }
|
---|
| 1368 | else
|
---|
| 1369 | WinSetDlgItemText(hwnd,IAD_DATA,inidata->data);
|
---|
| 1370 | }
|
---|
| 1371 | PostMsg(hwnd,UM_SETDIR,MPFROMLONG(1L),MPVOID);
|
---|
| 1372 | }
|
---|
| 1373 | else
|
---|
| 1374 | PostMsg(hwnd,UM_SETDIR,MPVOID,MPVOID);
|
---|
| 1375 | {
|
---|
| 1376 | CHAR s[32];
|
---|
| 1377 |
|
---|
| 1378 | *s = 0;
|
---|
| 1379 | WinQueryDlgItemText(hwnd,IAD_DATA,32,s);
|
---|
| 1380 | if(*s)
|
---|
| 1381 | WinEnableWindow(WinWindowFromID(hwnd,DID_OK),TRUE);
|
---|
| 1382 | }
|
---|
| 1383 | WinSendDlgItemMsg(hwnd,IAD_APPNAME,EM_QUERYCHANGED,MPVOID,MPVOID);
|
---|
| 1384 | WinSendDlgItemMsg(hwnd,IAD_KEYNAME,EM_QUERYCHANGED,MPVOID,MPVOID);
|
---|
| 1385 | WinSendDlgItemMsg(hwnd,IAD_DATA,EM_QUERYCHANGED,MPVOID,MPVOID);
|
---|
| 1386 | break;
|
---|
| 1387 |
|
---|
| 1388 | case UM_SETDIR:
|
---|
| 1389 | if(mp1)
|
---|
| 1390 | WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwnd,IAD_DATA));
|
---|
| 1391 | else
|
---|
| 1392 | WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwnd,IAD_KEYNAME));
|
---|
| 1393 | return 0;
|
---|
| 1394 |
|
---|
| 1395 | case UM_SETUP:
|
---|
| 1396 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 1397 | hwnd,
|
---|
| 1398 | GetPString(IDS_WARNINGTEXT),
|
---|
| 1399 | GetPString(IDS_INIAPPKEYEXISTSTEXT));
|
---|
| 1400 | return 0;
|
---|
| 1401 |
|
---|
| 1402 | case WM_CONTROL:
|
---|
| 1403 | switch(SHORT2FROMMP(mp1)) {
|
---|
| 1404 | case EN_KILLFOCUS:
|
---|
| 1405 | inidata = INSTDATA(hwnd);
|
---|
| 1406 | if(inidata) {
|
---|
| 1407 |
|
---|
| 1408 | CHAR s[CCHMAXPATH],applname[CCHMAXPATH];
|
---|
| 1409 | BOOL appchanged = FALSE,keychanged = FALSE;
|
---|
| 1410 |
|
---|
| 1411 | *applname = 0;
|
---|
| 1412 | WinQueryDlgItemText(hwnd,IAD_APPNAME,CCHMAXPATH,applname);
|
---|
| 1413 | lstrip(rstrip(applname));
|
---|
| 1414 | if(*applname) {
|
---|
| 1415 | *s = 0;
|
---|
| 1416 | WinQueryDlgItemText(hwnd,IAD_KEYNAME,CCHMAXPATH,s);
|
---|
| 1417 | lstrip(rstrip(s));
|
---|
| 1418 | if(*s) {
|
---|
| 1419 | appchanged = (BOOL)WinSendDlgItemMsg(hwnd,IAD_APPNAME,
|
---|
| 1420 | EM_QUERYCHANGED,
|
---|
| 1421 | MPVOID,MPVOID);
|
---|
| 1422 | keychanged = (BOOL)WinSendDlgItemMsg(hwnd,IAD_KEYNAME,
|
---|
| 1423 | EM_QUERYCHANGED,
|
---|
| 1424 | MPVOID,MPVOID);
|
---|
| 1425 | if(appchanged || keychanged) {
|
---|
| 1426 |
|
---|
| 1427 | ULONG size = 0L;
|
---|
| 1428 |
|
---|
| 1429 | if(PrfQueryProfileSize(inidata->hini,applname,s,&size))
|
---|
| 1430 | PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID);
|
---|
| 1431 | }
|
---|
| 1432 | *s = 0;
|
---|
| 1433 | WinQueryDlgItemText(hwnd,IAD_DATA,CCHMAXPATH,s);
|
---|
| 1434 | lstrip(rstrip(s));
|
---|
| 1435 | WinEnableWindow(WinWindowFromID(hwnd,DID_OK),(*s != 0));
|
---|
| 1436 | }
|
---|
| 1437 | else
|
---|
| 1438 | WinEnableWindow(WinWindowFromID(hwnd,DID_OK),FALSE);
|
---|
| 1439 | }
|
---|
| 1440 | else
|
---|
| 1441 | WinEnableWindow(WinWindowFromID(hwnd,DID_OK),FALSE);
|
---|
| 1442 | }
|
---|
| 1443 | break;
|
---|
| 1444 | }
|
---|
| 1445 | return 0;
|
---|
| 1446 |
|
---|
| 1447 | case WM_COMMAND:
|
---|
| 1448 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 1449 | case DID_OK:
|
---|
| 1450 | {
|
---|
| 1451 | CHAR applname[CCHMAXPATH],keyname[CCHMAXPATH],data[CCHMAXPATH];
|
---|
| 1452 | INT len;
|
---|
| 1453 |
|
---|
| 1454 | inidata = INSTDATA(hwnd);
|
---|
| 1455 | if(!inidata) {
|
---|
| 1456 | DosBeep(50,100);
|
---|
| 1457 | break;
|
---|
| 1458 | }
|
---|
| 1459 | inidata->isbinary = WinQueryButtonCheckstate(hwnd,IAD_ISBINARY);
|
---|
| 1460 | *applname = 0;
|
---|
| 1461 | WinQueryDlgItemText(hwnd,IAD_APPNAME,CCHMAXPATH,applname);
|
---|
| 1462 | lstrip(rstrip(applname));
|
---|
| 1463 | if(*applname) {
|
---|
| 1464 | *keyname = 0;
|
---|
| 1465 | WinQueryDlgItemText(hwnd,IAD_KEYNAME,CCHMAXPATH,keyname);
|
---|
| 1466 | lstrip(rstrip(keyname));
|
---|
| 1467 | if(*keyname) {
|
---|
| 1468 | *data = 0;
|
---|
| 1469 | WinQueryDlgItemText(hwnd,IAD_DATA,CCHMAXPATH,data);
|
---|
| 1470 | if(*data) {
|
---|
| 1471 | if(inidata->isbinary)
|
---|
| 1472 | len = literal(data);
|
---|
| 1473 | else
|
---|
| 1474 | len = strlen(data) + 1;
|
---|
| 1475 | PrfWriteProfileData(inidata->hini,applname,keyname,data,
|
---|
| 1476 | (ULONG)len);
|
---|
| 1477 | WinSendMsg(inidata->hwndIni,UM_RESCAN,
|
---|
| 1478 | MPFROMP(applname),
|
---|
| 1479 | MPFROMP(keyname));
|
---|
| 1480 | WinDismissDlg(hwnd,1);
|
---|
| 1481 | }
|
---|
| 1482 | }
|
---|
| 1483 | }
|
---|
| 1484 | }
|
---|
| 1485 | break;
|
---|
| 1486 |
|
---|
| 1487 | case DID_CANCEL:
|
---|
| 1488 | WinDismissDlg(hwnd,0);
|
---|
| 1489 | break;
|
---|
| 1490 |
|
---|
| 1491 | case IDM_HELP:
|
---|
| 1492 | if(hwndHelp)
|
---|
| 1493 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 1494 | MPFROM2SHORT(HELP_INIADD,0),
|
---|
| 1495 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 1496 | break;
|
---|
| 1497 | }
|
---|
| 1498 | return 0;
|
---|
| 1499 | }
|
---|
| 1500 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
| 1501 | }
|
---|
| 1502 |
|
---|
| 1503 |
|
---|
| 1504 | static ULONG flFrameFlags = FCF_SYSMENU | FCF_SIZEBORDER | FCF_ICON |
|
---|
| 1505 | FCF_TITLEBAR | FCF_MINMAX | FCF_MENU |
|
---|
| 1506 | FCF_ACCELTABLE | FCF_NOBYTEALIGN;
|
---|
| 1507 |
|
---|
| 1508 | HWND StartIniEditor (HWND hwnd,CHAR *fname,INT flags) {
|
---|
| 1509 |
|
---|
| 1510 | /*
|
---|
| 1511 | * create an ini editor window
|
---|
| 1512 | * bitmapped flags:
|
---|
| 1513 | * 2 = don't position window for non-desktop client
|
---|
| 1514 | * 4 = don't kill proc when closed
|
---|
| 1515 | */
|
---|
| 1516 |
|
---|
| 1517 | HWND hwndFrame,hwndClient;
|
---|
| 1518 | HINI hINI;
|
---|
| 1519 | HAB useHab = (HAB)0;
|
---|
| 1520 | CHAR *filename = NULL;
|
---|
| 1521 |
|
---|
| 1522 | if(fExternalINIs || strcmp(realappname,FM3Str))
|
---|
| 1523 | hwnd = HWND_DESKTOP;
|
---|
| 1524 | if(hwnd != HWND_DESKTOP)
|
---|
| 1525 | useHab = WinQueryAnchorBlock(hwnd);
|
---|
| 1526 | if(fname && *fname) {
|
---|
| 1527 | filename = strdup(fname);
|
---|
| 1528 | if(!filename)
|
---|
| 1529 | return (HWND)0;
|
---|
| 1530 | hINI = PrfOpenProfile(useHab,filename);
|
---|
| 1531 | if(!hINI) {
|
---|
| 1532 | free(filename);
|
---|
| 1533 | return (HWND)0;
|
---|
| 1534 | }
|
---|
| 1535 | else
|
---|
| 1536 | PrfCloseProfile(hINI);
|
---|
| 1537 | }
|
---|
| 1538 |
|
---|
| 1539 | if(ParentIsDesktop(hwnd,hwnd))
|
---|
| 1540 | flFrameFlags |= FCF_TASKLIST;
|
---|
| 1541 | hwndFrame = WinCreateStdWindow(hwnd,
|
---|
| 1542 | 0,
|
---|
| 1543 | &flFrameFlags,
|
---|
| 1544 | GetPString(IDS_WCINIEDITOR),
|
---|
| 1545 | NullStr,
|
---|
| 1546 | fwsAnimate,
|
---|
| 1547 | FM3ModHandle,
|
---|
| 1548 | INI_FRAME,
|
---|
| 1549 | &hwndClient);
|
---|
| 1550 | if(hwndFrame) {
|
---|
| 1551 | WinSetWindowUShort(hwndFrame,QWS_ID,INI_FRAME);
|
---|
| 1552 | if(!ParentIsDesktop(hwndFrame,hwnd) && !(flags & 2)) {
|
---|
| 1553 |
|
---|
| 1554 | SWP swp;
|
---|
| 1555 |
|
---|
| 1556 | FillClient(hwnd,&swp,NULL,FALSE);
|
---|
| 1557 | WinSetWindowPos(hwndFrame,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,
|
---|
| 1558 | SWP_SIZE | SWP_MOVE);
|
---|
| 1559 | }
|
---|
| 1560 | else if(ParentIsDesktop(hwndFrame,hwnd)) {
|
---|
| 1561 | if(!WinRestoreWindowPos(FM2Str,
|
---|
| 1562 | "INIWindowPos",
|
---|
| 1563 | hwndFrame)) {
|
---|
| 1564 |
|
---|
| 1565 | ULONG fl = SWP_MOVE | SWP_SIZE;
|
---|
| 1566 | SWP swp;
|
---|
| 1567 |
|
---|
| 1568 | WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame),0L,&swp);
|
---|
| 1569 | if(swp.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 1570 | fl = swp.fl;
|
---|
| 1571 | else if(swp.fl & SWP_ACTIVATE)
|
---|
| 1572 | fl |= SWP_ACTIVATE;
|
---|
| 1573 | WinSetWindowPos(hwndFrame,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,fl);
|
---|
| 1574 | }
|
---|
| 1575 | }
|
---|
| 1576 | PostMsg(hwndClient,UM_SELECT,MPVOID,MPVOID);
|
---|
| 1577 | PostMsg(hwndClient,UM_ACTION,MPVOID,MPVOID);
|
---|
| 1578 | if(!PostMsg(hwndClient,UM_LOADFILE,MPFROMP(((filename && *filename) ?
|
---|
| 1579 | filename : NULL)),
|
---|
| 1580 | MPVOID))
|
---|
| 1581 | WinSendMsg(hwndClient,UM_LOADFILE,MPFROMP(((filename && *filename) ?
|
---|
| 1582 | filename : NULL)),
|
---|
| 1583 | MPVOID);
|
---|
| 1584 | if(flags & 4)
|
---|
| 1585 | PostMsg(hwndClient,UM_INITIALSIZE,MPVOID,MPVOID);
|
---|
| 1586 | }
|
---|
| 1587 | else if(filename)
|
---|
| 1588 | free(filename);
|
---|
| 1589 | return hwndFrame;
|
---|
| 1590 | }
|
---|
| 1591 |
|
---|
| 1592 |
|
---|
| 1593 | MRESULT EXPENTRY IniLBSubProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1594 |
|
---|
| 1595 | PFNWP oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
|
---|
| 1596 | static HWND hwndPopup = (HWND)0;
|
---|
| 1597 |
|
---|
| 1598 | switch(msg) {
|
---|
| 1599 | case WM_SETFOCUS:
|
---|
| 1600 | if(mp2)
|
---|
| 1601 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),UM_FOCUSME,mp1,mp2);
|
---|
| 1602 | break;
|
---|
| 1603 |
|
---|
| 1604 | case WM_MENUEND:
|
---|
| 1605 | if(hwndPopup == (HWND)mp2) {
|
---|
| 1606 | WinDestroyWindow(hwndPopup);
|
---|
| 1607 | hwndPopup = (HWND)0;
|
---|
| 1608 | }
|
---|
| 1609 | break;
|
---|
| 1610 |
|
---|
| 1611 | case WM_CONTEXTMENU:
|
---|
| 1612 | {
|
---|
| 1613 | USHORT id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1614 |
|
---|
| 1615 | switch(id) {
|
---|
| 1616 | case INI_APPLIST:
|
---|
| 1617 | id = INI_APPMENU;
|
---|
| 1618 | break;
|
---|
| 1619 | case INI_KEYLIST:
|
---|
| 1620 | id = INI_KEYMENU;
|
---|
| 1621 | break;
|
---|
| 1622 | default:
|
---|
| 1623 | id = 0;
|
---|
| 1624 | break;
|
---|
| 1625 | }
|
---|
| 1626 | if(id) {
|
---|
| 1627 | if(hwndPopup)
|
---|
| 1628 | WinDestroyWindow(hwndPopup);
|
---|
| 1629 | hwndPopup = WinLoadMenu(HWND_DESKTOP,FM3ModHandle,id);
|
---|
| 1630 | if(hwndPopup)
|
---|
| 1631 | WinPopupMenu(hwnd, WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1632 | hwndPopup, 8, 8, 0,
|
---|
| 1633 | PU_HCONSTRAIN | PU_VCONSTRAIN |
|
---|
| 1634 | PU_KEYBOARD | PU_MOUSEBUTTON1);
|
---|
| 1635 | }
|
---|
| 1636 | }
|
---|
| 1637 | break;
|
---|
| 1638 |
|
---|
| 1639 | case WM_BEGINDRAG:
|
---|
| 1640 | {
|
---|
| 1641 | PDRAGINFO pDInfo;
|
---|
| 1642 | DRAGITEM DItem;
|
---|
| 1643 | DRAGIMAGE DIcon;
|
---|
| 1644 | INIDATA *inidata;
|
---|
| 1645 | HPOINTER hptrINI;
|
---|
| 1646 | USHORT id;
|
---|
| 1647 |
|
---|
| 1648 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1649 | inidata = WinQueryWindowPtr(WinQueryWindow(hwnd,QW_PARENT),0);
|
---|
| 1650 | if(!inidata || !*inidata->ininame || !*inidata->applname ||
|
---|
| 1651 | !inidata->keyname) {
|
---|
| 1652 | DosBeep(50,100);
|
---|
| 1653 | break;
|
---|
| 1654 | }
|
---|
| 1655 | hptrINI = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,INI_FRAME);
|
---|
| 1656 | memset(&DItem,0,sizeof(DItem));
|
---|
| 1657 | memset(&DIcon,0,sizeof(DIcon));
|
---|
| 1658 | DIcon.cb = sizeof(DIcon);
|
---|
| 1659 | DIcon.cptl = 0;
|
---|
| 1660 | DIcon.hImage = hptrINI;
|
---|
| 1661 | DIcon.fl = DRG_ICON;
|
---|
| 1662 | DIcon.sizlStretch.cx = 32;
|
---|
| 1663 | DIcon.sizlStretch.cy = 32;
|
---|
| 1664 | DIcon.cxOffset = -16;
|
---|
| 1665 | DIcon.cyOffset = 0;
|
---|
| 1666 | DItem.hwndItem = hwnd;
|
---|
| 1667 | DItem.ulItemID = 0L;
|
---|
| 1668 | DItem.hstrType = DrgAddStrHandle(DRT_UNKNOWN);
|
---|
| 1669 | DItem.hstrRMF =
|
---|
| 1670 | DrgAddStrHandle("<DRM_FM2INIRECORD,DRF_FM2INI>");
|
---|
| 1671 | DItem.hstrContainerName = DrgAddStrHandle(inidata->ininame);
|
---|
| 1672 | DItem.hstrSourceName = DrgAddStrHandle(inidata->applname);
|
---|
| 1673 | if(id == INI_APPLIST)
|
---|
| 1674 | DItem.hstrTargetName = DrgAddStrHandle(NullStr);
|
---|
| 1675 | else
|
---|
| 1676 | DItem.hstrTargetName = DrgAddStrHandle(inidata->keyname);
|
---|
| 1677 | DItem.fsControl = 0;
|
---|
| 1678 | DItem.fsSupportedOps = DO_COPYABLE | DO_LINKABLE | DO_MOVEABLE;
|
---|
| 1679 | pDInfo = DrgAllocDraginfo(1L);
|
---|
| 1680 | DrgSetDragitem(pDInfo,&DItem,sizeof(DRAGITEM),0L);
|
---|
| 1681 | DrgDrag(hwnd,pDInfo,&DIcon,1L,VK_ENDDRAG,(PVOID)NULL);
|
---|
| 1682 | DrgFreeDraginfo(pDInfo);
|
---|
| 1683 | WinDestroyPointer(hptrINI);
|
---|
| 1684 | }
|
---|
| 1685 | break;
|
---|
| 1686 |
|
---|
| 1687 | case DM_DRAGOVER:
|
---|
| 1688 | {
|
---|
| 1689 | PDRAGINFO pDInfo = (PDRAGINFO)mp1;
|
---|
| 1690 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
| 1691 |
|
---|
| 1692 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
| 1693 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
| 1694 | 0); /* Index to DRAGITEM */
|
---|
| 1695 | if(DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
| 1696 | DRM_OS2FILE, /* mechanisms and data */
|
---|
| 1697 | NULL)) {
|
---|
| 1698 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
| 1699 | return(MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
| 1700 | DO_LINK));
|
---|
| 1701 | }
|
---|
| 1702 | else if(DrgVerifyRMF(pDItem,
|
---|
| 1703 | DRM_FM2INIRECORD,
|
---|
| 1704 | DRF_FM2INI)) {
|
---|
| 1705 | if(WinQueryWindow(pDInfo->hwndSource,QW_PARENT) ==
|
---|
| 1706 | WinQueryWindow(hwnd,QW_PARENT)) {
|
---|
| 1707 | DrgFreeDraginfo(pDInfo);
|
---|
| 1708 | return MRFROM2SHORT(DOR_NEVERDROP,0);
|
---|
| 1709 | }
|
---|
| 1710 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
| 1711 | return(MRFROM2SHORT(DOR_DROP,
|
---|
| 1712 | ((fCopyDefault) ?
|
---|
| 1713 | DO_COPY :
|
---|
| 1714 | DO_MOVE)));
|
---|
| 1715 | }
|
---|
| 1716 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
| 1717 | return MRFROM2SHORT(DOR_NEVERDROP,0);
|
---|
| 1718 | }
|
---|
| 1719 |
|
---|
| 1720 | case DM_DRAGLEAVE:
|
---|
| 1721 |
|
---|
| 1722 | break;
|
---|
| 1723 |
|
---|
| 1724 | case DM_DROP:
|
---|
| 1725 | {
|
---|
| 1726 | PDRAGINFO pDInfo = (PDRAGINFO)mp1;
|
---|
| 1727 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
| 1728 | ULONG numitems,curitem = 0L,len;
|
---|
| 1729 | USHORT action;
|
---|
| 1730 | CHAR szFrom[CCHMAXPATH + 2],szDir[CCHMAXPATH + 1],
|
---|
| 1731 | szTemp[CCHMAXPATH + 2];
|
---|
| 1732 | FILESTATUS3 fsa;
|
---|
| 1733 | INIREC inirec;
|
---|
| 1734 |
|
---|
| 1735 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
| 1736 | numitems = DrgQueryDragitemCount(pDInfo);
|
---|
| 1737 | while(curitem < numitems) {
|
---|
| 1738 | pDItem = DrgQueryDragitemPtr(pDInfo,
|
---|
| 1739 | curitem);
|
---|
| 1740 | if(DrgVerifyRMF(pDItem,DRM_OS2FILE,NULL)) {
|
---|
| 1741 | if(pDItem->fsControl & DC_PREPARE)
|
---|
| 1742 | DrgSendTransferMsg(pDItem->hwndItem,
|
---|
| 1743 | DM_ENDCONVERSATION,
|
---|
| 1744 | MPFROMLONG(pDItem->ulItemID),
|
---|
| 1745 | MPFROMLONG(DMFL_TARGETFAIL));
|
---|
| 1746 | else {
|
---|
| 1747 | if(FullDrgName(pDItem,szFrom,sizeof(szFrom)) &&
|
---|
| 1748 | !DosQueryPathInfo(szFrom,FIL_STANDARD,&fsa,
|
---|
| 1749 | (ULONG)sizeof(FILESTATUS3)))
|
---|
| 1750 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),WM_COMMAND,
|
---|
| 1751 | MPFROM2SHORT(IDM_COMPARE,0),MPFROMP(szFrom));
|
---|
| 1752 | DrgSendTransferMsg(pDItem->hwndItem,
|
---|
| 1753 | DM_ENDCONVERSATION,
|
---|
| 1754 | MPFROMLONG(pDItem->ulItemID),
|
---|
| 1755 | MPFROMLONG(DMFL_TARGETFAIL));
|
---|
| 1756 | }
|
---|
| 1757 | }
|
---|
| 1758 | else if(DrgVerifyRMF(pDItem,
|
---|
| 1759 | DRM_FM2INIRECORD,
|
---|
| 1760 | DRF_FM2INI)) {
|
---|
| 1761 | *szDir = *szFrom = *szTemp = 0;
|
---|
| 1762 | len = DrgQueryStrName(pDItem->hstrContainerName,
|
---|
| 1763 | CCHMAXPATH,szDir);
|
---|
| 1764 | szDir[len] = 0;
|
---|
| 1765 | len = DrgQueryStrName(pDItem->hstrSourceName,
|
---|
| 1766 | CCHMAXPATH,szFrom);
|
---|
| 1767 | szFrom[len] = 0;
|
---|
| 1768 | len = DrgQueryStrName(pDItem->hstrTargetName,
|
---|
| 1769 | CCHMAXPATH,szTemp);
|
---|
| 1770 | szTemp[len] = 0;
|
---|
| 1771 | switch(pDInfo->usOperation) {
|
---|
| 1772 | case DO_MOVE:
|
---|
| 1773 | action = IDM_MOVE;
|
---|
| 1774 | break;
|
---|
| 1775 | case DO_COPY:
|
---|
| 1776 | action = IDM_COPY;
|
---|
| 1777 | break;
|
---|
| 1778 | default:
|
---|
| 1779 | action = IDM_INFO;
|
---|
| 1780 | break;
|
---|
| 1781 | }
|
---|
| 1782 | memset(&inirec,0,sizeof(inirec));
|
---|
| 1783 | inirec.size = sizeof(inirec);
|
---|
| 1784 | strcpy(inirec.filename2,szDir);
|
---|
| 1785 | strcpy(inirec.app,szFrom);
|
---|
| 1786 | strcpy(inirec.key,szTemp);
|
---|
| 1787 | inirec.action = action;
|
---|
| 1788 | inirec.hwndSource = WinQueryWindow(pDInfo->hwndSource,QW_PARENT);
|
---|
| 1789 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),WM_COMMAND,
|
---|
| 1790 | MPFROM2SHORT(action,0),MPFROMP(&inirec));
|
---|
| 1791 | DrgSendTransferMsg(pDItem->hwndItem,
|
---|
| 1792 | DM_ENDCONVERSATION,
|
---|
| 1793 | MPFROMLONG(pDItem->ulItemID),
|
---|
| 1794 | MPFROMLONG(DMFL_TARGETFAIL));
|
---|
| 1795 | }
|
---|
| 1796 | curitem++;
|
---|
| 1797 | }
|
---|
| 1798 | DrgDeleteDraginfoStrHandles(pDInfo);
|
---|
| 1799 | DrgFreeDraginfo(pDInfo);
|
---|
| 1800 | }
|
---|
| 1801 | return 0;
|
---|
| 1802 |
|
---|
| 1803 | case WM_DESTROY:
|
---|
| 1804 | if(hwndPopup)
|
---|
| 1805 | WinDestroyWindow(hwndPopup);
|
---|
| 1806 | hwndPopup = (HWND)0;
|
---|
| 1807 | break;
|
---|
| 1808 | }
|
---|
| 1809 | if(oldproc)
|
---|
| 1810 | return oldproc(hwnd,msg,mp1,mp2);
|
---|
| 1811 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 1812 | }
|
---|
| 1813 |
|
---|
| 1814 |
|
---|
| 1815 | MRESULT EXPENTRY IniLBSubProc2 (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1816 |
|
---|
| 1817 | PFNWP oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
|
---|
| 1818 |
|
---|
| 1819 | switch(msg) {
|
---|
| 1820 | case WM_SETFOCUS:
|
---|
| 1821 | if(mp2)
|
---|
| 1822 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),UM_FOCUSME,mp1,mp2);
|
---|
| 1823 | break;
|
---|
| 1824 | }
|
---|
| 1825 | if(oldproc)
|
---|
| 1826 | return oldproc(hwnd,msg,mp1,mp2);
|
---|
| 1827 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 1828 | }
|
---|
| 1829 |
|
---|
| 1830 |
|
---|
| 1831 | MRESULT EXPENTRY IniProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1832 |
|
---|
| 1833 | INIDATA *inidata;
|
---|
| 1834 | SHORT sSel;
|
---|
| 1835 |
|
---|
| 1836 | switch(msg) {
|
---|
| 1837 | case WM_CREATE:
|
---|
| 1838 | inidata = malloc(sizeof(INIDATA));
|
---|
| 1839 | if(!inidata) {
|
---|
| 1840 | PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID);
|
---|
| 1841 | break;
|
---|
| 1842 | }
|
---|
| 1843 | memset(inidata,0,sizeof(INIDATA));
|
---|
| 1844 | inidata->size = sizeof(INIDATA);
|
---|
| 1845 | inidata->confirm = TRUE;
|
---|
| 1846 | inidata->currid = INI_APPLIST;
|
---|
| 1847 | inidata->hwndMenu = WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1848 | FID_MENU);
|
---|
| 1849 | inidata->hwndIni = hwnd;
|
---|
| 1850 | WinSetWindowPtr(hwnd,0,(PVOID)inidata);
|
---|
| 1851 | WinCheckMenuItem(inidata->hwndMenu,INI_CONFIRM,inidata->confirm);
|
---|
| 1852 | WinCreateWindow(hwnd,WC_LISTBOX,(PSZ)NULL,WS_VISIBLE | LS_HORZSCROLL |
|
---|
| 1853 | LS_NOADJUSTPOS, 0,0,0,0,hwnd,HWND_TOP,
|
---|
| 1854 | INI_APPLIST,NULL,NULL);
|
---|
| 1855 | WinCreateWindow(hwnd,WC_LISTBOX,(PSZ)NULL,WS_VISIBLE | LS_HORZSCROLL |
|
---|
| 1856 | LS_NOADJUSTPOS, 0,0,0,0,hwnd,HWND_TOP,
|
---|
| 1857 | INI_KEYLIST,NULL,NULL);
|
---|
| 1858 | WinCreateWindow(hwnd,WC_LISTBOX,(PSZ)NULL,WS_VISIBLE | LS_HORZSCROLL |
|
---|
| 1859 | LS_NOADJUSTPOS, 0,0,0,0,hwnd,HWND_TOP,
|
---|
| 1860 | INI_DATALIST,NULL,NULL);
|
---|
| 1861 | WinCreateWindow(hwnd,WC_STATIC,(PSZ)NULL,WS_VISIBLE | SS_TEXT |
|
---|
| 1862 | DT_CENTER | DT_VCENTER,0,0,0,0,hwnd,HWND_TOP,
|
---|
| 1863 | INI_NUMAPPS,NULL,NULL);
|
---|
| 1864 | WinCreateWindow(hwnd,WC_STATIC,(PSZ)NULL,WS_VISIBLE | SS_TEXT |
|
---|
| 1865 | DT_CENTER | DT_VCENTER,0,0,0,0,hwnd,HWND_TOP,
|
---|
| 1866 | INI_NUMKEYS,NULL,NULL);
|
---|
| 1867 | WinCreateWindow(hwnd,WC_STATIC,(PSZ)NULL,WS_VISIBLE | SS_TEXT |
|
---|
| 1868 | DT_CENTER | DT_VCENTER,0,0,0,0,hwnd,HWND_TOP,
|
---|
| 1869 | INI_NUMDATA,NULL,NULL);
|
---|
| 1870 | WinCreateWindow(hwnd,
|
---|
| 1871 | WC_STATIC,
|
---|
| 1872 | GetPString(IDS_APPLICATIONSTITLETEXT),
|
---|
| 1873 | WS_VISIBLE | SS_TEXT |
|
---|
| 1874 | DT_CENTER | DT_VCENTER,
|
---|
| 1875 | 0,
|
---|
| 1876 | 0,
|
---|
| 1877 | 0,
|
---|
| 1878 | 0,
|
---|
| 1879 | hwnd,
|
---|
| 1880 | HWND_TOP,
|
---|
| 1881 | INI_APPHDR,
|
---|
| 1882 | NULL,
|
---|
| 1883 | NULL);
|
---|
| 1884 | WinCreateWindow(hwnd,
|
---|
| 1885 | WC_STATIC,
|
---|
| 1886 | GetPString(IDS_KEYWORDSTITLETEXT),
|
---|
| 1887 | WS_VISIBLE | SS_TEXT |
|
---|
| 1888 | DT_CENTER | DT_VCENTER,
|
---|
| 1889 | 0,
|
---|
| 1890 | 0,
|
---|
| 1891 | 0,
|
---|
| 1892 | 0,
|
---|
| 1893 | hwnd,
|
---|
| 1894 | HWND_TOP,
|
---|
| 1895 | INI_KEYHDR,
|
---|
| 1896 | NULL,
|
---|
| 1897 | NULL);
|
---|
| 1898 | WinCreateWindow(hwnd,
|
---|
| 1899 | WC_STATIC,
|
---|
| 1900 | GetPString(IDS_DATABYTESTITLETEXT),
|
---|
| 1901 | WS_VISIBLE | SS_TEXT |
|
---|
| 1902 | DT_CENTER | DT_VCENTER,
|
---|
| 1903 | 0,
|
---|
| 1904 | 0,
|
---|
| 1905 | 0,
|
---|
| 1906 | 0,
|
---|
| 1907 | hwnd,
|
---|
| 1908 | HWND_TOP,
|
---|
| 1909 | INI_DATAHDR,
|
---|
| 1910 | NULL,
|
---|
| 1911 | NULL);
|
---|
| 1912 | inidata->hwndApp = WinWindowFromID(hwnd,INI_APPLIST);
|
---|
| 1913 | inidata->hwndKey = WinWindowFromID(hwnd,INI_KEYLIST);
|
---|
| 1914 | inidata->hwndData = WinWindowFromID(hwnd,INI_DATALIST);
|
---|
| 1915 | {
|
---|
| 1916 | PFNWP oldproc;
|
---|
| 1917 |
|
---|
| 1918 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 1919 | (PFNWP)IniLBSubProc);
|
---|
| 1920 | if(oldproc)
|
---|
| 1921 | WinSetWindowPtr(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 1922 | 0,
|
---|
| 1923 | (PVOID)oldproc);
|
---|
| 1924 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd,INI_KEYLIST),
|
---|
| 1925 | (PFNWP)IniLBSubProc);
|
---|
| 1926 | if(oldproc)
|
---|
| 1927 | WinSetWindowPtr(WinWindowFromID(hwnd,INI_KEYLIST),
|
---|
| 1928 | 0,
|
---|
| 1929 | (PVOID)oldproc);
|
---|
| 1930 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd,INI_DATALIST),
|
---|
| 1931 | (PFNWP)IniLBSubProc2);
|
---|
| 1932 | if(oldproc)
|
---|
| 1933 | WinSetWindowPtr(WinWindowFromID(hwnd,INI_DATALIST),
|
---|
| 1934 | 0,
|
---|
| 1935 | (PVOID)oldproc);
|
---|
| 1936 | }
|
---|
| 1937 | break;
|
---|
| 1938 |
|
---|
| 1939 | case UM_FOCUSME:
|
---|
| 1940 | case WM_SETFOCUS:
|
---|
| 1941 | if(mp2) {
|
---|
| 1942 | if(hwndMain && fAutoView)
|
---|
| 1943 | PostMsg(hwndMain,
|
---|
| 1944 | UM_LOADFILE,
|
---|
| 1945 | MPVOID,
|
---|
| 1946 | MPVOID);
|
---|
| 1947 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 1948 | if(inidata && hwndStatus) {
|
---|
| 1949 | if(*inidata->ininame) {
|
---|
| 1950 | WinSetWindowText(hwndStatus,
|
---|
| 1951 | GetPString(IDS_INTERNALINIVIEWERTEXT));
|
---|
| 1952 | if(hwndStatus2)
|
---|
| 1953 | WinSetWindowText(hwndStatus2,
|
---|
| 1954 | inidata->ininame);
|
---|
| 1955 | }
|
---|
| 1956 | else
|
---|
| 1957 | PostMsg(hwnd,
|
---|
| 1958 | UM_SETUP,
|
---|
| 1959 | MPVOID,
|
---|
| 1960 | MPVOID);
|
---|
| 1961 | }
|
---|
| 1962 | }
|
---|
| 1963 | if(msg == WM_SETFOCUS)
|
---|
| 1964 | break;
|
---|
| 1965 | return 0;
|
---|
| 1966 |
|
---|
| 1967 | case UM_SELECT:
|
---|
| 1968 | WinSetFocus(HWND_DESKTOP,
|
---|
| 1969 | WinWindowFromID(hwnd,INI_APPLIST));
|
---|
| 1970 | break;
|
---|
| 1971 |
|
---|
| 1972 | case UM_ACTION:
|
---|
| 1973 | SetPresParams(WinWindowFromID(hwnd,INI_APPHDR),
|
---|
| 1974 | &RGBGREY,
|
---|
| 1975 | &RGBBLACK,
|
---|
| 1976 | &RGBBLACK,
|
---|
| 1977 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 1978 | SetPresParams(WinWindowFromID(hwnd,INI_KEYHDR),
|
---|
| 1979 | &RGBGREY,
|
---|
| 1980 | &RGBBLACK,
|
---|
| 1981 | &RGBBLACK,
|
---|
| 1982 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 1983 | SetPresParams(WinWindowFromID(hwnd,INI_DATAHDR),
|
---|
| 1984 | &RGBGREY,
|
---|
| 1985 | &RGBBLACK,
|
---|
| 1986 | &RGBBLACK,
|
---|
| 1987 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 1988 | SetPresParams(WinWindowFromID(hwnd,INI_NUMAPPS),
|
---|
| 1989 | &RGBGREY,
|
---|
| 1990 | &RGBBLACK,
|
---|
| 1991 | &RGBBLACK,
|
---|
| 1992 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 1993 | SetPresParams(WinWindowFromID(hwnd,INI_NUMKEYS),
|
---|
| 1994 | &RGBGREY,
|
---|
| 1995 | &RGBBLACK,
|
---|
| 1996 | &RGBBLACK,
|
---|
| 1997 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 1998 | SetPresParams(WinWindowFromID(hwnd,INI_NUMDATA),
|
---|
| 1999 | &RGBGREY,
|
---|
| 2000 | &RGBBLACK,
|
---|
| 2001 | &RGBBLACK,
|
---|
| 2002 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 2003 | if(!WinSetPresParam(WinWindowFromID(hwnd,INI_DATALIST),
|
---|
| 2004 | PP_FONTNAMESIZE,
|
---|
| 2005 | (ULONG)strlen(GetPString(IDS_5SYSTEMVIOTEXT)) + 1,
|
---|
| 2006 | (PVOID)GetPString(IDS_5SYSTEMVIOTEXT)))
|
---|
| 2007 | WinSetPresParam(WinWindowFromID(hwnd,INI_DATALIST),
|
---|
| 2008 | PP_FONTNAMESIZE,
|
---|
| 2009 | (ULONG)strlen(GetPString(IDS_10SYSTEMMONOTEXT)) + 1,
|
---|
| 2010 | (PVOID)GetPString(IDS_10SYSTEMMONOTEXT));
|
---|
| 2011 | RestorePresParams(hwnd,
|
---|
| 2012 | "IniUtil");
|
---|
| 2013 | return 0;
|
---|
| 2014 |
|
---|
| 2015 | case WM_PRESPARAMCHANGED:
|
---|
| 2016 | PresParamChanged(hwnd,
|
---|
| 2017 | "IniUtil",
|
---|
| 2018 | mp1,
|
---|
| 2019 | mp2);
|
---|
| 2020 | break;
|
---|
| 2021 |
|
---|
| 2022 | case UM_RESCAN:
|
---|
| 2023 | inidata = INSTDATA(hwnd);
|
---|
| 2024 | if(inidata) {
|
---|
| 2025 | if(mp1) {
|
---|
| 2026 |
|
---|
| 2027 | SHORT numitems,sSelect;
|
---|
| 2028 | BOOL inprofile;
|
---|
| 2029 | ULONG size = 0L;
|
---|
| 2030 |
|
---|
| 2031 | numitems = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2032 | INI_APPLIST,
|
---|
| 2033 | LM_QUERYITEMCOUNT,
|
---|
| 2034 | MPVOID,
|
---|
| 2035 | MPVOID);
|
---|
| 2036 | if(!numitems) {
|
---|
| 2037 | PostMsg(hwnd,
|
---|
| 2038 | WM_COMMAND,
|
---|
| 2039 | MPFROM2SHORT(INI_REFRESH,0),
|
---|
| 2040 | MPVOID);
|
---|
| 2041 | return 0;
|
---|
| 2042 | }
|
---|
| 2043 | size = 0L;
|
---|
| 2044 | if(PrfQueryProfileSize(inidata->hini,
|
---|
| 2045 | (CHAR *)mp1,
|
---|
| 2046 | NULL,
|
---|
| 2047 | (PULONG)&size) &&
|
---|
| 2048 | size)
|
---|
| 2049 | inprofile = TRUE;
|
---|
| 2050 | else
|
---|
| 2051 | inprofile = FALSE;
|
---|
| 2052 | sSelect = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2053 | INI_APPLIST,
|
---|
| 2054 | LM_SEARCHSTRING,
|
---|
| 2055 | MPFROM2SHORT(LSS_CASESENSITIVE,
|
---|
| 2056 | LIT_FIRST),
|
---|
| 2057 | MPFROMP((CHAR *)mp1));
|
---|
| 2058 | if(sSelect >= 0) {
|
---|
| 2059 | if(!inprofile)
|
---|
| 2060 | WinSendDlgItemMsg(hwnd,
|
---|
| 2061 | INI_APPLIST,
|
---|
| 2062 | LM_DELETEITEM,
|
---|
| 2063 | MPFROMSHORT(sSelect),
|
---|
| 2064 | MPVOID);
|
---|
| 2065 | else if(!strcmp(inidata->applname,(CHAR *)mp1))
|
---|
| 2066 | PostMsg(hwnd,
|
---|
| 2067 | WM_CONTROL,
|
---|
| 2068 | MPFROM2SHORT(INI_APPLIST,LN_SELECT),
|
---|
| 2069 | MPFROMLONG(WinWindowFromID(hwnd,INI_APPLIST)));
|
---|
| 2070 | }
|
---|
| 2071 | else if(inprofile)
|
---|
| 2072 | WinSendDlgItemMsg(hwnd,
|
---|
| 2073 | INI_APPLIST,
|
---|
| 2074 | LM_INSERTITEM,
|
---|
| 2075 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 2076 | MPFROMP((CHAR *)mp1));
|
---|
| 2077 | if(mp2 && inidata->applname) {
|
---|
| 2078 | if(!EnumKeyNames(WinWindowFromID(hwnd,INI_KEYLIST),
|
---|
| 2079 | inidata->hini,inidata->applname))
|
---|
| 2080 | PostMsg(hwnd,
|
---|
| 2081 | WM_COMMAND,
|
---|
| 2082 | MPFROM2SHORT(INI_REFRESH,0),
|
---|
| 2083 | MPVOID);
|
---|
| 2084 | }
|
---|
| 2085 | }
|
---|
| 2086 | }
|
---|
| 2087 | return 0;
|
---|
| 2088 |
|
---|
| 2089 | case UM_INITIALSIZE: /* kludge */
|
---|
| 2090 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 2091 | if(inidata)
|
---|
| 2092 | inidata->dontclose = TRUE;
|
---|
| 2093 | return 0;
|
---|
| 2094 |
|
---|
| 2095 | case WM_SIZE:
|
---|
| 2096 | {
|
---|
| 2097 | SHORT cx = SHORT1FROMMP(mp2);
|
---|
| 2098 | SHORT cy = SHORT2FROMMP(mp2);
|
---|
| 2099 |
|
---|
| 2100 | WinSetWindowPos(WinWindowFromID(hwnd,INI_APPHDR),HWND_TOP,
|
---|
| 2101 | 2,cy - 22,(cx / 4) - 4,20,
|
---|
| 2102 | SWP_MOVE | SWP_SIZE);
|
---|
| 2103 | WinSetWindowPos(WinWindowFromID(hwnd,INI_NUMAPPS),HWND_TOP,
|
---|
| 2104 | (cx / 4) + 2,cy - 22,(cx / 4) - 4,20,
|
---|
| 2105 | SWP_MOVE | SWP_SIZE);
|
---|
| 2106 | WinSetWindowPos(WinWindowFromID(hwnd,INI_APPLIST),HWND_TOP,
|
---|
| 2107 | 2,(cy / 2) + 2,(cx / 2) - 4,(cy / 2) - 28,
|
---|
| 2108 | SWP_MOVE | SWP_SIZE);
|
---|
| 2109 | WinSetWindowPos(WinWindowFromID(hwnd,INI_KEYHDR),HWND_TOP,
|
---|
| 2110 | (cx / 2) + 2,cy - 22,(cx / 4) - 4,20,
|
---|
| 2111 | SWP_MOVE | SWP_SIZE);
|
---|
| 2112 | WinSetWindowPos(WinWindowFromID(hwnd,INI_NUMKEYS),HWND_TOP,
|
---|
| 2113 | (cx - (cx / 4)) + 2,cy - 22,(cx / 4) - 4,20,
|
---|
| 2114 | SWP_MOVE | SWP_SIZE);
|
---|
| 2115 | WinSetWindowPos(WinWindowFromID(hwnd,INI_KEYLIST),HWND_TOP,
|
---|
| 2116 | (cx / 2) + 2,(cy / 2) + 2,(cx / 2) - 4,(cy / 2) - 28,
|
---|
| 2117 | SWP_MOVE | SWP_SIZE);
|
---|
| 2118 | WinSetWindowPos(WinWindowFromID(hwnd,INI_DATAHDR),HWND_TOP,
|
---|
| 2119 | 2,(cy / 2) - 22,(cx / 2) - 4,20,
|
---|
| 2120 | SWP_MOVE | SWP_SIZE);
|
---|
| 2121 | WinSetWindowPos(WinWindowFromID(hwnd,INI_NUMDATA),HWND_TOP,
|
---|
| 2122 | (cx / 2) + 2,(cy / 2) - 22,(cx / 2) - 4,20,
|
---|
| 2123 | SWP_MOVE | SWP_SIZE);
|
---|
| 2124 | WinSetWindowPos(WinWindowFromID(hwnd,INI_DATALIST),HWND_TOP,
|
---|
| 2125 | 2,2,cx - 4,(cy / 2) - 28,
|
---|
| 2126 | SWP_MOVE | SWP_SIZE);
|
---|
| 2127 | }
|
---|
| 2128 | break;
|
---|
| 2129 |
|
---|
| 2130 | case UM_LOADFILE:
|
---|
| 2131 | /* load initial file */
|
---|
| 2132 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 2133 | if(inidata) {
|
---|
| 2134 | if(mp1) {
|
---|
| 2135 | strcpy(inidata->ininame,(CHAR *)mp1);
|
---|
| 2136 | inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),
|
---|
| 2137 | inidata->ininame);
|
---|
| 2138 | free(mp1);
|
---|
| 2139 | }
|
---|
| 2140 | else
|
---|
| 2141 | inidata->hini = HINI_USERPROFILE;
|
---|
| 2142 | if(!inidata->hini) {
|
---|
| 2143 | PostMsg(hwnd,
|
---|
| 2144 | WM_CLOSE,
|
---|
| 2145 | MPVOID,
|
---|
| 2146 | MPVOID);
|
---|
| 2147 | break;
|
---|
| 2148 | }
|
---|
| 2149 | WinSendMsg(hwnd,
|
---|
| 2150 | UM_SETUP,
|
---|
| 2151 | MPVOID,
|
---|
| 2152 | MPVOID);
|
---|
| 2153 | WinSendMsg(hwnd,
|
---|
| 2154 | UM_SETDIR,
|
---|
| 2155 | MPVOID,
|
---|
| 2156 | MPVOID);
|
---|
| 2157 | WinSetWindowPos(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2158 | HWND_TOP,
|
---|
| 2159 | 0,
|
---|
| 2160 | 0,
|
---|
| 2161 | 0,
|
---|
| 2162 | 0,
|
---|
| 2163 | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 2164 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2165 | inidata->hini);
|
---|
| 2166 | }
|
---|
| 2167 | else
|
---|
| 2168 | PostMsg(hwnd,
|
---|
| 2169 | WM_CLOSE,
|
---|
| 2170 | MPVOID,
|
---|
| 2171 | MPVOID);
|
---|
| 2172 | return 0;
|
---|
| 2173 |
|
---|
| 2174 | case WM_ERASEBACKGROUND:
|
---|
| 2175 | WinFillRect((HPS)mp1,
|
---|
| 2176 | (PRECTL)mp2,
|
---|
| 2177 | 0x00d0d0d0);
|
---|
| 2178 | return 0;
|
---|
| 2179 |
|
---|
| 2180 | case WM_PAINT:
|
---|
| 2181 | {
|
---|
| 2182 | HPS hps;
|
---|
| 2183 | RECTL rcl;
|
---|
| 2184 |
|
---|
| 2185 | hps = WinBeginPaint(hwnd,(HPS)0,NULL);
|
---|
| 2186 | if(hps) {
|
---|
| 2187 | WinQueryWindowRect(hwnd,&rcl);
|
---|
| 2188 | WinFillRect(hps,
|
---|
| 2189 | &rcl,
|
---|
| 2190 | CLR_PALEGRAY);
|
---|
| 2191 | WinEndPaint(hps);
|
---|
| 2192 | /*
|
---|
| 2193 | * tell status window to paint its box
|
---|
| 2194 | */
|
---|
| 2195 | PaintRecessedWindow(WinWindowFromID(hwnd,INI_APPHDR),
|
---|
| 2196 | (HPS)0,
|
---|
| 2197 | FALSE,
|
---|
| 2198 | FALSE);
|
---|
| 2199 | PaintRecessedWindow(WinWindowFromID(hwnd,INI_KEYHDR),
|
---|
| 2200 | (HPS)0,
|
---|
| 2201 | FALSE,
|
---|
| 2202 | FALSE);
|
---|
| 2203 | PaintRecessedWindow(WinWindowFromID(hwnd,INI_DATAHDR),
|
---|
| 2204 | (HPS)0,
|
---|
| 2205 | FALSE,
|
---|
| 2206 | FALSE);
|
---|
| 2207 | PaintRecessedWindow(WinWindowFromID(hwnd,INI_NUMAPPS),
|
---|
| 2208 | (HPS)0,
|
---|
| 2209 | FALSE,
|
---|
| 2210 | FALSE);
|
---|
| 2211 | PaintRecessedWindow(WinWindowFromID(hwnd,INI_NUMKEYS),
|
---|
| 2212 | (HPS)0,
|
---|
| 2213 | FALSE,
|
---|
| 2214 | FALSE);
|
---|
| 2215 | PaintRecessedWindow(WinWindowFromID(hwnd,INI_NUMDATA),
|
---|
| 2216 | (HPS)0,
|
---|
| 2217 | FALSE,
|
---|
| 2218 | FALSE);
|
---|
| 2219 | inidata = INSTDATA(hwnd);
|
---|
| 2220 | if(inidata && inidata->hwndCurrent)
|
---|
| 2221 | BoxWindow(inidata->hwndCurrent,(HPS)0,CLR_RED);
|
---|
| 2222 | }
|
---|
| 2223 | }
|
---|
| 2224 | break;
|
---|
| 2225 |
|
---|
| 2226 | case WM_CONTROL:
|
---|
| 2227 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 2228 | case INI_KEYLIST:
|
---|
| 2229 | case INI_APPLIST:
|
---|
| 2230 | case INI_DATALIST:
|
---|
| 2231 | switch(SHORT2FROMMP(mp1)) {
|
---|
| 2232 | case LN_SETFOCUS:
|
---|
| 2233 | inidata = INSTDATA(hwnd);
|
---|
| 2234 | if(inidata) {
|
---|
| 2235 | if(inidata->hwndCurrent)
|
---|
| 2236 | BoxWindow(inidata->hwndCurrent,
|
---|
| 2237 | (HPS)0,
|
---|
| 2238 | CLR_PALEGRAY);
|
---|
| 2239 | inidata->hwndCurrent = WinWindowFromID(hwnd,
|
---|
| 2240 | SHORT1FROMMP(mp1));
|
---|
| 2241 | BoxWindow(WinWindowFromID(hwnd,
|
---|
| 2242 | SHORT1FROMMP(mp1)),
|
---|
| 2243 | (HPS)0,
|
---|
| 2244 | CLR_RED);
|
---|
| 2245 | }
|
---|
| 2246 | break;
|
---|
| 2247 |
|
---|
| 2248 | case LN_ENTER:
|
---|
| 2249 | case LN_SELECT:
|
---|
| 2250 | if(SHORT1FROMMP(mp1) == INI_DATALIST)
|
---|
| 2251 | break;
|
---|
| 2252 | {
|
---|
| 2253 | CHAR applname[CCHMAXPATH],keyname[CCHMAXPATH];
|
---|
| 2254 | SHORT sSelect;
|
---|
| 2255 |
|
---|
| 2256 | inidata = INSTDATA(hwnd);
|
---|
| 2257 | if(!inidata || !inidata->hini)
|
---|
| 2258 | break;
|
---|
| 2259 | WinSendMsg(hwnd,UM_SETDIR,MPVOID,MPVOID);
|
---|
| 2260 | inidata->keyindex = inidata->appindex = 0;
|
---|
| 2261 | *applname = *keyname = *inidata->applname =
|
---|
| 2262 | *inidata->keyname = 0;
|
---|
| 2263 | sSelect = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2264 | INI_APPLIST,
|
---|
| 2265 | LM_QUERYSELECTION,
|
---|
| 2266 | MPFROM2SHORT(LIT_FIRST,0),
|
---|
| 2267 | MPVOID);
|
---|
| 2268 | if(sSelect < 0)
|
---|
| 2269 | break;
|
---|
| 2270 | inidata->appindex = sSelect;
|
---|
| 2271 | WinSendDlgItemMsg(hwnd,
|
---|
| 2272 | INI_APPLIST,
|
---|
| 2273 | LM_QUERYITEMTEXT,
|
---|
| 2274 | MPFROM2SHORT(sSelect,CCHMAXPATH - 1),
|
---|
| 2275 | MPFROMP(applname));
|
---|
| 2276 | if(SHORT1FROMMP(mp1) == INI_APPLIST) {
|
---|
| 2277 | if(!EnumKeyNames(WinWindowFromID(hwnd,INI_KEYLIST),
|
---|
| 2278 | inidata->hini,
|
---|
| 2279 | applname))
|
---|
| 2280 | PostMsg(hwnd,
|
---|
| 2281 | WM_COMMAND,
|
---|
| 2282 | MPFROM2SHORT(INI_REFRESH,0),
|
---|
| 2283 | MPVOID);
|
---|
| 2284 | }
|
---|
| 2285 | else {
|
---|
| 2286 | sSelect = (SHORT)WinSendDlgItemMsg(hwnd,INI_KEYLIST,
|
---|
| 2287 | LM_QUERYSELECTION,
|
---|
| 2288 | MPFROM2SHORT(LIT_FIRST,0),
|
---|
| 2289 | MPVOID);
|
---|
| 2290 | if(sSelect < 0)
|
---|
| 2291 | break;
|
---|
| 2292 | inidata->keyindex = sSelect;
|
---|
| 2293 | WinSendDlgItemMsg(hwnd,
|
---|
| 2294 | INI_KEYLIST,
|
---|
| 2295 | LM_QUERYITEMTEXT,
|
---|
| 2296 | MPFROM2SHORT(sSelect,CCHMAXPATH - 1),
|
---|
| 2297 | MPFROMP(keyname));
|
---|
| 2298 | if(!*keyname || !*applname)
|
---|
| 2299 | break;
|
---|
| 2300 | strcpy(inidata->keyname,keyname);
|
---|
| 2301 | strcpy(inidata->applname,applname);
|
---|
| 2302 | if(inidata->data)
|
---|
| 2303 | free(inidata->data);
|
---|
| 2304 | inidata->data = GetKeyData(WinWindowFromID(hwnd,
|
---|
| 2305 | INI_DATALIST),
|
---|
| 2306 | inidata->hini,
|
---|
| 2307 | applname,
|
---|
| 2308 | keyname,
|
---|
| 2309 | &inidata->datalen);
|
---|
| 2310 | if(!inidata->data)
|
---|
| 2311 | PostMsg(hwnd,
|
---|
| 2312 | WM_COMMAND,
|
---|
| 2313 | MPFROM2SHORT(INI_REFRESH,0),
|
---|
| 2314 | MPVOID);
|
---|
| 2315 | }
|
---|
| 2316 | }
|
---|
| 2317 | break;
|
---|
| 2318 | }
|
---|
| 2319 | break;
|
---|
| 2320 | }
|
---|
| 2321 | return 0;
|
---|
| 2322 |
|
---|
| 2323 | case UM_SETDIR:
|
---|
| 2324 | {
|
---|
| 2325 | SHORT num;
|
---|
| 2326 | CHAR s[81];
|
---|
| 2327 |
|
---|
| 2328 | num = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2329 | INI_APPLIST,
|
---|
| 2330 | LM_QUERYITEMCOUNT,
|
---|
| 2331 | MPVOID,
|
---|
| 2332 | MPVOID);
|
---|
| 2333 | sprintf(s,"%d",num);
|
---|
| 2334 | WinSetDlgItemText(hwnd,INI_NUMAPPS,s);
|
---|
| 2335 | num = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2336 | INI_KEYLIST,
|
---|
| 2337 | LM_QUERYITEMCOUNT,
|
---|
| 2338 | MPVOID,
|
---|
| 2339 | MPVOID);
|
---|
| 2340 | sprintf(s,"%d",num);
|
---|
| 2341 | WinSetDlgItemText(hwnd,
|
---|
| 2342 | INI_NUMKEYS,
|
---|
| 2343 | s);
|
---|
| 2344 | WinSetDlgItemText(hwnd,
|
---|
| 2345 | INI_NUMDATA,
|
---|
| 2346 | "0");
|
---|
| 2347 | WinSendDlgItemMsg(hwnd,
|
---|
| 2348 | INI_DATALIST,
|
---|
| 2349 | LM_DELETEALL,
|
---|
| 2350 | MPVOID,
|
---|
| 2351 | MPVOID);
|
---|
| 2352 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 2353 | }
|
---|
| 2354 | return 0;
|
---|
| 2355 |
|
---|
| 2356 | case UM_SETUP:
|
---|
| 2357 | inidata = INSTDATA(hwnd);
|
---|
| 2358 | if(inidata) {
|
---|
| 2359 |
|
---|
| 2360 | PRFPROFILE prfp;
|
---|
| 2361 | CHAR sysini[CCHMAXPATH + 81];
|
---|
| 2362 | CHAR userini[CCHMAXPATH];
|
---|
| 2363 |
|
---|
| 2364 | memset(&prfp,0,sizeof(PRFPROFILE));
|
---|
| 2365 | prfp.cchUserName = CCHMAXPATH;
|
---|
| 2366 | prfp.cchSysName = CCHMAXPATH;
|
---|
| 2367 | prfp.pszUserName = (PSZ)userini;
|
---|
| 2368 | prfp.pszSysName = (PSZ)sysini;
|
---|
| 2369 | if(PrfQueryProfile(WinQueryAnchorBlock(hwnd),&prfp)) {
|
---|
| 2370 | if(inidata->hini == HINI_SYSTEMPROFILE)
|
---|
| 2371 | strcpy(inidata->ininame,sysini);
|
---|
| 2372 | else if(inidata->hini == HINI_USERPROFILE)
|
---|
| 2373 | strcpy(inidata->ininame,userini);
|
---|
| 2374 | sprintf(sysini,
|
---|
| 2375 | GetPString(IDS_INITITLETEXT),
|
---|
| 2376 | inidata->ininame);
|
---|
| 2377 | WinSetWindowText(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2378 | sysini);
|
---|
| 2379 | if(WinQueryWindow(hwnd,QW_PARENT) ==
|
---|
| 2380 | WinQueryActiveWindow(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2381 | QW_PARENT))) {
|
---|
| 2382 | if(hwndStatus)
|
---|
| 2383 | WinSetWindowText(hwndStatus,
|
---|
| 2384 | GetPString(IDS_INTERNALINIVIEWERTEXT));
|
---|
| 2385 | if(hwndStatus2)
|
---|
| 2386 | WinSetWindowText(hwndStatus2,
|
---|
| 2387 | inidata->ininame);
|
---|
| 2388 | }
|
---|
| 2389 | }
|
---|
| 2390 | else
|
---|
| 2391 | WinSetWindowText(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2392 | GetPString(IDS_INIQUERYPRFFAILEDTEXT));
|
---|
| 2393 | }
|
---|
| 2394 | else
|
---|
| 2395 | PostMsg(hwnd,
|
---|
| 2396 | WM_CLOSE,
|
---|
| 2397 | MPVOID,
|
---|
| 2398 | MPVOID);
|
---|
| 2399 | return 0;
|
---|
| 2400 |
|
---|
| 2401 | case WM_CHAR:
|
---|
| 2402 | if(!(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
---|
| 2403 | if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
| 2404 | switch(SHORT2FROMMP(mp2)) {
|
---|
| 2405 | case VK_DELETE:
|
---|
| 2406 | inidata = INSTDATA(hwnd);
|
---|
| 2407 | if(inidata) {
|
---|
| 2408 |
|
---|
| 2409 | SHORT cmd;
|
---|
| 2410 |
|
---|
| 2411 | cmd = (inidata->hwndCurrent &&
|
---|
| 2412 | WinQueryWindowUShort(inidata->hwndCurrent,QWS_ID) ==
|
---|
| 2413 | INI_APPLIST) ? INI_DELETEAPP : INI_DELETEKEY;
|
---|
| 2414 | PostMsg(hwnd,
|
---|
| 2415 | WM_COMMAND,
|
---|
| 2416 | MPFROM2SHORT(cmd,0),
|
---|
| 2417 | MPVOID);
|
---|
| 2418 | }
|
---|
| 2419 | break;
|
---|
| 2420 | }
|
---|
| 2421 | }
|
---|
| 2422 | }
|
---|
| 2423 | break;
|
---|
| 2424 |
|
---|
| 2425 | case WM_COMMAND:
|
---|
| 2426 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 2427 | case IDM_FINDNEXT:
|
---|
| 2428 | case IDM_FINDFIRST:
|
---|
| 2429 | inidata = INSTDATA(hwnd);
|
---|
| 2430 | if(inidata) {
|
---|
| 2431 | if(inidata->hwndCurrent) {
|
---|
| 2432 |
|
---|
| 2433 | STRINGINPARMS sip;
|
---|
| 2434 | static CHAR tofind[258] = "";
|
---|
| 2435 | SHORT x,z;
|
---|
| 2436 |
|
---|
| 2437 | if(SHORT1FROMMP(mp1) == IDM_FINDFIRST || !*tofind) {
|
---|
| 2438 | z = LIT_FIRST;
|
---|
| 2439 | memset(&sip,0,sizeof(sip));
|
---|
| 2440 | sip.help = GetPString(IDS_INISEARCHHELPTEXT);
|
---|
| 2441 | sip.prompt = GetPString(IDS_INISEARCHPROMPTTEXT);
|
---|
| 2442 | sip.inputlen = 257;
|
---|
| 2443 | sip.ret = tofind;
|
---|
| 2444 | sip.title = GetPString(IDS_INISEARCHTITLETEXT);
|
---|
| 2445 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 2446 | hwnd,
|
---|
| 2447 | InputDlgProc,
|
---|
| 2448 | FM3ModHandle,
|
---|
| 2449 | STR_FRAME,
|
---|
| 2450 | &sip)) {
|
---|
| 2451 | if(!*rstrip(tofind)) {
|
---|
| 2452 | DosBeep(50,100);
|
---|
| 2453 | break;
|
---|
| 2454 | }
|
---|
| 2455 | }
|
---|
| 2456 | else
|
---|
| 2457 | break;
|
---|
| 2458 | }
|
---|
| 2459 | else {
|
---|
| 2460 | z = (SHORT)WinSendMsg(inidata->hwndCurrent,
|
---|
| 2461 | LM_QUERYSELECTION,
|
---|
| 2462 | MPFROM2SHORT(LIT_CURSOR,0),
|
---|
| 2463 | MPVOID);
|
---|
| 2464 | if(z < 0)
|
---|
| 2465 | z = LIT_FIRST;
|
---|
| 2466 | }
|
---|
| 2467 | x = (SHORT)WinSendMsg(inidata->hwndCurrent,
|
---|
| 2468 | LM_SEARCHSTRING,
|
---|
| 2469 | MPFROM2SHORT(LSS_SUBSTRING,z),
|
---|
| 2470 | MPFROMP(tofind));
|
---|
| 2471 | if(x >= 0 && x > z) {
|
---|
| 2472 | WinSendMsg(inidata->hwndCurrent,
|
---|
| 2473 | LM_SETTOPINDEX,
|
---|
| 2474 | MPFROM2SHORT(x,0),
|
---|
| 2475 | MPVOID);
|
---|
| 2476 | WinSendMsg(inidata->hwndCurrent,
|
---|
| 2477 | LM_SELECTITEM,
|
---|
| 2478 | MPFROM2SHORT(x,0),
|
---|
| 2479 | MPFROM2SHORT(TRUE,0));
|
---|
| 2480 | }
|
---|
| 2481 | else
|
---|
| 2482 | DosBeep(250,100);
|
---|
| 2483 | }
|
---|
| 2484 | }
|
---|
| 2485 | break;
|
---|
| 2486 |
|
---|
| 2487 | case IDM_FILTER:
|
---|
| 2488 | inidata = INSTDATA(hwnd);
|
---|
| 2489 | if(inidata) {
|
---|
| 2490 |
|
---|
| 2491 | SHORT numitems;
|
---|
| 2492 |
|
---|
| 2493 | numitems = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2494 | INI_APPLIST,
|
---|
| 2495 | LM_QUERYITEMCOUNT,
|
---|
| 2496 | MPVOID,
|
---|
| 2497 | MPVOID);
|
---|
| 2498 | if(numitems)
|
---|
| 2499 | WinDlgBox(HWND_DESKTOP,
|
---|
| 2500 | hwnd,
|
---|
| 2501 | FilterIniProc,
|
---|
| 2502 | FM3ModHandle,
|
---|
| 2503 | IAF_FRAME,
|
---|
| 2504 | (PVOID)inidata);
|
---|
| 2505 | else
|
---|
| 2506 | DosBeep(50,100);
|
---|
| 2507 | }
|
---|
| 2508 | break;
|
---|
| 2509 |
|
---|
| 2510 | case IDM_COPY:
|
---|
| 2511 | case IDM_INFO:
|
---|
| 2512 | case IDM_MOVE:
|
---|
| 2513 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 2514 | if(!inidata || !*inidata->ininame)
|
---|
| 2515 | break;
|
---|
| 2516 | if(mp2) {
|
---|
| 2517 |
|
---|
| 2518 | INIREC *inirec;
|
---|
| 2519 |
|
---|
| 2520 | inirec = malloc(sizeof(INIREC));
|
---|
| 2521 | if(inirec) {
|
---|
| 2522 | memset(inirec,0,sizeof(INIREC));
|
---|
| 2523 | *inirec = *(INIREC *)mp2;
|
---|
| 2524 | inirec->hwndDlg = hwnd;
|
---|
| 2525 | inirec->confirm = inidata->confirm;
|
---|
| 2526 | strcpy(inirec->filename1,inidata->ininame);
|
---|
| 2527 | if(_beginthread(CopyIni,
|
---|
| 2528 | NULL,
|
---|
| 2529 | 122880,
|
---|
| 2530 | (PVOID)inirec) == -1) {
|
---|
| 2531 | DosBeep(250,100);
|
---|
| 2532 | free(inirec);
|
---|
| 2533 | }
|
---|
| 2534 | }
|
---|
| 2535 | else
|
---|
| 2536 | DosBeep(50,100);
|
---|
| 2537 | }
|
---|
| 2538 | break;
|
---|
| 2539 |
|
---|
| 2540 | case IDM_COMPARE:
|
---|
| 2541 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 2542 | if(!inidata || !*inidata->ininame)
|
---|
| 2543 | break;
|
---|
| 2544 | if(mp2) {
|
---|
| 2545 |
|
---|
| 2546 | INIREC *inirec;
|
---|
| 2547 |
|
---|
| 2548 | inirec = malloc(sizeof(INIREC));
|
---|
| 2549 | if(inirec) {
|
---|
| 2550 | strcpy(inirec->filename2,(CHAR *)(mp2));
|
---|
| 2551 | strcpy(inirec->filename1,inidata->ininame);
|
---|
| 2552 | inirec->hwndDlg = hwnd;
|
---|
| 2553 | if(_beginthread(CompareIni,
|
---|
| 2554 | NULL,
|
---|
| 2555 | 122880,
|
---|
| 2556 | (PVOID)inirec) == -1) {
|
---|
| 2557 | DosBeep(250,100);
|
---|
| 2558 | free(inirec);
|
---|
| 2559 | }
|
---|
| 2560 | }
|
---|
| 2561 | }
|
---|
| 2562 | break;
|
---|
| 2563 |
|
---|
| 2564 | case INI_COPYAPP:
|
---|
| 2565 | case INI_COPYKEY:
|
---|
| 2566 | case INI_RENAMEAPP:
|
---|
| 2567 | case INI_RENAMEKEY:
|
---|
| 2568 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 2569 | if(!inidata ||
|
---|
| 2570 | !*inidata->ininame ||
|
---|
| 2571 | !*inidata->applname ||
|
---|
| 2572 | (!*inidata->keyname &&
|
---|
| 2573 | (SHORT1FROMMP(mp1) == INI_RENAMEKEY ||
|
---|
| 2574 | SHORT1FROMMP(mp1) == INI_COPYKEY)))
|
---|
| 2575 | break;
|
---|
| 2576 | {
|
---|
| 2577 | INIREC *inirec;
|
---|
| 2578 |
|
---|
| 2579 | inirec = malloc(sizeof(INIREC));
|
---|
| 2580 | if(inirec) {
|
---|
| 2581 | memset(inirec,0,sizeof(INIREC));
|
---|
| 2582 | inirec->size = sizeof(INIREC);
|
---|
| 2583 | inirec->hwndDlg = hwnd;
|
---|
| 2584 | inirec->confirm = inidata->confirm;
|
---|
| 2585 | inirec->action = (SHORT1FROMMP(mp1) == INI_COPYAPP ||
|
---|
| 2586 | SHORT1FROMMP(mp1) == INI_COPYKEY) ?
|
---|
| 2587 | IDM_COPY : IDM_MOVE;
|
---|
| 2588 | strcpy(inirec->filename1,inidata->ininame);
|
---|
| 2589 | strcpy(inirec->filename2,inidata->ininame);
|
---|
| 2590 | if(SHORT1FROMMP(mp1) == INI_COPYKEY ||
|
---|
| 2591 | SHORT1FROMMP(mp1) == INI_RENAMEKEY)
|
---|
| 2592 | strcpy(inirec->key,inidata->keyname);
|
---|
| 2593 | strcpy(inirec->app,inidata->applname);
|
---|
| 2594 | if(!WinDlgBox(HWND_DESKTOP,
|
---|
| 2595 | hwnd,
|
---|
| 2596 | IntraIniProc,
|
---|
| 2597 | FM3ModHandle,
|
---|
| 2598 | INII_FRAME,
|
---|
| 2599 | (PVOID)inirec)) {
|
---|
| 2600 | free(inirec);
|
---|
| 2601 | break;
|
---|
| 2602 | }
|
---|
| 2603 | if(_beginthread(CopyIni,
|
---|
| 2604 | NULL,
|
---|
| 2605 | 122880,
|
---|
| 2606 | (PVOID)inirec) == -1) {
|
---|
| 2607 | DosBeep(250,100);
|
---|
| 2608 | free(inirec);
|
---|
| 2609 | }
|
---|
| 2610 | }
|
---|
| 2611 | else
|
---|
| 2612 | DosBeep(50,100);
|
---|
| 2613 | }
|
---|
| 2614 | break;
|
---|
| 2615 |
|
---|
| 2616 | case INI_BACKUPINI:
|
---|
| 2617 | inidata = INSTDATA(hwnd);
|
---|
| 2618 | if(inidata && *inidata->ininame) {
|
---|
| 2619 |
|
---|
| 2620 | CHAR filename[CCHMAXPATH],*p;
|
---|
| 2621 |
|
---|
| 2622 | strcpy(filename,inidata->ininame);
|
---|
| 2623 | p = filename;
|
---|
| 2624 | while(*p) {
|
---|
| 2625 | if(*p == '/')
|
---|
| 2626 | *p = '\\';
|
---|
| 2627 | p++;
|
---|
| 2628 | }
|
---|
| 2629 | p = strrchr(filename,'\\');
|
---|
| 2630 | if(p) {
|
---|
| 2631 | p++;
|
---|
| 2632 | *p = 0;
|
---|
| 2633 | }
|
---|
| 2634 | else
|
---|
| 2635 | *filename = 0;
|
---|
| 2636 | strcat(filename,"*.INI");
|
---|
| 2637 | if(export_filename(hwnd,filename,TRUE)) {
|
---|
| 2638 |
|
---|
| 2639 | PPRFPROFILE prfp;
|
---|
| 2640 |
|
---|
| 2641 | prfp = malloc(sizeof(PRFPROFILE));
|
---|
| 2642 | if(prfp) {
|
---|
| 2643 | memset(prfp,0,sizeof(PRFPROFILE));
|
---|
| 2644 | prfp->pszUserName = strdup(inidata->ininame);
|
---|
| 2645 | if(prfp->pszUserName) {
|
---|
| 2646 | prfp->cchUserName = strlen(prfp->pszUserName);
|
---|
| 2647 | prfp->pszSysName = strdup(filename);
|
---|
| 2648 | if(prfp->pszSysName) {
|
---|
| 2649 | prfp->cchSysName = strlen(prfp->pszSysName);
|
---|
| 2650 | if(_beginthread(BackupIni,
|
---|
| 2651 | NULL,
|
---|
| 2652 | 122880,
|
---|
| 2653 | (PVOID)prfp) == -1) {
|
---|
| 2654 | free(prfp->pszSysName);
|
---|
| 2655 | free(prfp->pszUserName);
|
---|
| 2656 | free(prfp);
|
---|
| 2657 | DosBeep(250,100);
|
---|
| 2658 | }
|
---|
| 2659 | else
|
---|
| 2660 | DosSleep(250L);
|
---|
| 2661 | }
|
---|
| 2662 | else {
|
---|
| 2663 | free(prfp->pszUserName);
|
---|
| 2664 | free(prfp);
|
---|
| 2665 | DosBeep(250,100);
|
---|
| 2666 | }
|
---|
| 2667 | }
|
---|
| 2668 | else {
|
---|
| 2669 | free(prfp);
|
---|
| 2670 | DosBeep(250,100);
|
---|
| 2671 | }
|
---|
| 2672 | }
|
---|
| 2673 | }
|
---|
| 2674 | }
|
---|
| 2675 | break;
|
---|
| 2676 |
|
---|
| 2677 | case INI_CHANGEINI:
|
---|
| 2678 | inidata = INSTDATA(hwnd);
|
---|
| 2679 | if(inidata) {
|
---|
| 2680 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 2681 | hwnd,
|
---|
| 2682 | ChangeIniProc,
|
---|
| 2683 | FM3ModHandle,
|
---|
| 2684 | INIR_FRAME,
|
---|
| 2685 | (PVOID)inidata->ininame)) {
|
---|
| 2686 | WinSendMsg(hwnd,
|
---|
| 2687 | UM_SETUP,
|
---|
| 2688 | MPVOID,
|
---|
| 2689 | MPVOID);
|
---|
| 2690 | WinSendMsg(hwnd,
|
---|
| 2691 | UM_SETDIR,
|
---|
| 2692 | MPVOID,
|
---|
| 2693 | MPVOID);
|
---|
| 2694 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2695 | inidata->hini);
|
---|
| 2696 | }
|
---|
| 2697 | }
|
---|
| 2698 | break;
|
---|
| 2699 |
|
---|
| 2700 | case INI_SWAPINI:
|
---|
| 2701 | inidata = INSTDATA(hwnd);
|
---|
| 2702 | if(inidata) {
|
---|
| 2703 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 2704 | hwnd,
|
---|
| 2705 | SwapIniProc,
|
---|
| 2706 | FM3ModHandle,
|
---|
| 2707 | INIR_FRAME,
|
---|
| 2708 | (PVOID)inidata->ininame)) {
|
---|
| 2709 | WinSendMsg(hwnd,
|
---|
| 2710 | UM_SETUP,
|
---|
| 2711 | MPVOID,
|
---|
| 2712 | MPVOID);
|
---|
| 2713 | WinSendMsg(hwnd,
|
---|
| 2714 | UM_SETDIR,
|
---|
| 2715 | MPVOID,
|
---|
| 2716 | MPVOID);
|
---|
| 2717 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2718 | inidata->hini);
|
---|
| 2719 | }
|
---|
| 2720 | }
|
---|
| 2721 | break;
|
---|
| 2722 |
|
---|
| 2723 | case IDM_NEXTWINDOW:
|
---|
| 2724 | inidata = INSTDATA(hwnd);
|
---|
| 2725 | if(inidata) {
|
---|
| 2726 | inidata->currid++;
|
---|
| 2727 | if(inidata->currid > INI_DATALIST)
|
---|
| 2728 | inidata->currid = INI_APPLIST;
|
---|
| 2729 | }
|
---|
| 2730 | WinSetFocus(HWND_DESKTOP,
|
---|
| 2731 | WinWindowFromID(hwnd,inidata->currid));
|
---|
| 2732 | break;
|
---|
| 2733 |
|
---|
| 2734 | case IDM_PREVWINDOW:
|
---|
| 2735 | inidata = INSTDATA(hwnd);
|
---|
| 2736 | if(inidata) {
|
---|
| 2737 | inidata->currid--;
|
---|
| 2738 | if(inidata->currid < INI_APPLIST)
|
---|
| 2739 | inidata->currid = INI_DATALIST;
|
---|
| 2740 | }
|
---|
| 2741 | WinSetFocus(HWND_DESKTOP,
|
---|
| 2742 | WinWindowFromID(hwnd,
|
---|
| 2743 | inidata->currid));
|
---|
| 2744 | break;
|
---|
| 2745 |
|
---|
| 2746 | case INI_CONFIRM:
|
---|
| 2747 | inidata = INSTDATA(hwnd);
|
---|
| 2748 | if(inidata) {
|
---|
| 2749 | inidata->confirm = (inidata->confirm) ? FALSE : TRUE;
|
---|
| 2750 | WinCheckMenuItem(inidata->hwndMenu,
|
---|
| 2751 | INI_CONFIRM,
|
---|
| 2752 | inidata->confirm);
|
---|
| 2753 |
|
---|
| 2754 | }
|
---|
| 2755 | break;
|
---|
| 2756 |
|
---|
| 2757 | case INI_EDITENTRY:
|
---|
| 2758 | case INI_ADDENTRY:
|
---|
| 2759 | inidata = INSTDATA(hwnd);
|
---|
| 2760 | if(inidata) {
|
---|
| 2761 | inidata->edit = (SHORT1FROMMP(mp1) == INI_EDITENTRY);
|
---|
| 2762 | WinDlgBox(HWND_DESKTOP,
|
---|
| 2763 | hwnd,
|
---|
| 2764 | AddIniProc,
|
---|
| 2765 | FM3ModHandle,
|
---|
| 2766 | IAD_FRAME,
|
---|
| 2767 | (PVOID)inidata);
|
---|
| 2768 | }
|
---|
| 2769 | break;
|
---|
| 2770 |
|
---|
| 2771 | case INI_OTHERPROFILE:
|
---|
| 2772 | inidata = INSTDATA(hwnd);
|
---|
| 2773 | if(inidata) {
|
---|
| 2774 |
|
---|
| 2775 | CHAR filename[CCHMAXPATH + 81],*p;
|
---|
| 2776 | FILESTATUS3 fsa;
|
---|
| 2777 | HINI hINI;
|
---|
| 2778 |
|
---|
| 2779 | strcpy(filename,inidata->ininame);
|
---|
| 2780 | p = filename;
|
---|
| 2781 | while(*p) {
|
---|
| 2782 | if(*p == '/')
|
---|
| 2783 | *p = '\\';
|
---|
| 2784 | p++;
|
---|
| 2785 | }
|
---|
| 2786 | p = strrchr(filename,'\\');
|
---|
| 2787 | if(p) {
|
---|
| 2788 | p++;
|
---|
| 2789 | *p = 0;
|
---|
| 2790 | }
|
---|
| 2791 | else
|
---|
| 2792 | *filename = 0;
|
---|
| 2793 | strcat(filename,"*.INI");
|
---|
| 2794 | if(insert_filename(hwnd,
|
---|
| 2795 | filename,
|
---|
| 2796 | TRUE,
|
---|
| 2797 | TRUE) &&
|
---|
| 2798 | *filename &&
|
---|
| 2799 | !DosQueryPathInfo(filename,
|
---|
| 2800 | FIL_STANDARD,
|
---|
| 2801 | &fsa,
|
---|
| 2802 | sizeof(fsa))) {
|
---|
| 2803 | hINI = PrfOpenProfile(WinQueryAnchorBlock(hwnd),
|
---|
| 2804 | filename);
|
---|
| 2805 | if(hINI) {
|
---|
| 2806 | if(*inidata->ininame) {
|
---|
| 2807 | if(inidata->hini)
|
---|
| 2808 | PrfCloseProfile(inidata->hini);
|
---|
| 2809 | *inidata->ininame = 0;
|
---|
| 2810 | }
|
---|
| 2811 | inidata->hini = hINI;
|
---|
| 2812 | strcpy(inidata->ininame,filename);
|
---|
| 2813 | WinSendMsg(hwnd,
|
---|
| 2814 | UM_SETUP,
|
---|
| 2815 | MPVOID,
|
---|
| 2816 | MPVOID);
|
---|
| 2817 | WinSendMsg(hwnd,
|
---|
| 2818 | UM_SETDIR,
|
---|
| 2819 | MPVOID,
|
---|
| 2820 | MPVOID);
|
---|
| 2821 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2822 | inidata->hini);
|
---|
| 2823 | }
|
---|
| 2824 | else
|
---|
| 2825 | General_Error(WinQueryAnchorBlock(hwnd),
|
---|
| 2826 | hwnd,
|
---|
| 2827 | __FILE__,
|
---|
| 2828 | __LINE__,
|
---|
| 2829 | GetPString(IDS_INICANTOPENINITEXT),
|
---|
| 2830 | filename);
|
---|
| 2831 | }
|
---|
| 2832 | }
|
---|
| 2833 | break;
|
---|
| 2834 |
|
---|
| 2835 | case INI_USERPROFILE:
|
---|
| 2836 | inidata = INSTDATA(hwnd);
|
---|
| 2837 | if(inidata) {
|
---|
| 2838 | if(inidata->hini &&
|
---|
| 2839 | inidata->hini != HINI_SYSTEMPROFILE &&
|
---|
| 2840 | inidata->hini != HINI_USERPROFILE)
|
---|
| 2841 | PrfCloseProfile(inidata->hini);
|
---|
| 2842 | *inidata->ininame = 0;
|
---|
| 2843 | inidata->hini = HINI_USERPROFILE;
|
---|
| 2844 | WinSendMsg(hwnd,
|
---|
| 2845 | UM_SETUP,
|
---|
| 2846 | MPVOID,
|
---|
| 2847 | MPVOID);
|
---|
| 2848 | WinSendMsg(hwnd,
|
---|
| 2849 | UM_SETDIR,
|
---|
| 2850 | MPVOID,
|
---|
| 2851 | MPVOID);
|
---|
| 2852 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2853 | inidata->hini);
|
---|
| 2854 | }
|
---|
| 2855 | break;
|
---|
| 2856 |
|
---|
| 2857 | case INI_SYSTEMPROFILE:
|
---|
| 2858 | inidata = INSTDATA(hwnd);
|
---|
| 2859 | if(inidata) {
|
---|
| 2860 | if(inidata->hini &&
|
---|
| 2861 | inidata->hini != HINI_SYSTEMPROFILE &&
|
---|
| 2862 | inidata->hini != HINI_USERPROFILE)
|
---|
| 2863 | PrfCloseProfile(inidata->hini);
|
---|
| 2864 | *inidata->ininame = 0;
|
---|
| 2865 | inidata->hini = HINI_SYSTEMPROFILE;
|
---|
| 2866 | WinSendMsg(hwnd,
|
---|
| 2867 | UM_SETUP,
|
---|
| 2868 | MPVOID,
|
---|
| 2869 | MPVOID);
|
---|
| 2870 | WinSendMsg(hwnd,
|
---|
| 2871 | UM_SETDIR,
|
---|
| 2872 | MPVOID,
|
---|
| 2873 | MPVOID);
|
---|
| 2874 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2875 | inidata->hini);
|
---|
| 2876 | }
|
---|
| 2877 | break;
|
---|
| 2878 |
|
---|
| 2879 | case INI_REFRESH:
|
---|
| 2880 | inidata = INSTDATA(hwnd);
|
---|
| 2881 | if(inidata) {
|
---|
| 2882 | WinSendMsg(hwnd,
|
---|
| 2883 | UM_SETDIR,
|
---|
| 2884 | MPVOID,
|
---|
| 2885 | MPVOID);
|
---|
| 2886 | EnumAppNames(WinWindowFromID(hwnd,INI_APPLIST),
|
---|
| 2887 | inidata->hini);
|
---|
| 2888 | }
|
---|
| 2889 | break;
|
---|
| 2890 |
|
---|
| 2891 | case INI_DELETEKEY:
|
---|
| 2892 | inidata = INSTDATA(hwnd);
|
---|
| 2893 | if(inidata && *inidata->applname &&
|
---|
| 2894 | *inidata->keyname) {
|
---|
| 2895 |
|
---|
| 2896 | SHORT keyindex = inidata->keyindex;
|
---|
| 2897 |
|
---|
| 2898 | if(inidata->confirm && saymsg(MB_YESNO,
|
---|
| 2899 | hwnd,
|
---|
| 2900 | GetPString(IDS_CONFIRMTEXT),
|
---|
| 2901 | GetPString(IDS_INIDELETEKEYTEXT),
|
---|
| 2902 | inidata->keyname) ==
|
---|
| 2903 | MBID_NO)
|
---|
| 2904 | break;
|
---|
| 2905 | PrfWriteProfileData(inidata->hini,
|
---|
| 2906 | inidata->applname,
|
---|
| 2907 | inidata->keyname,
|
---|
| 2908 | NULL,
|
---|
| 2909 | 0L);
|
---|
| 2910 | *inidata->keyname = 0;
|
---|
| 2911 | WinSendDlgItemMsg(hwnd,
|
---|
| 2912 | INI_KEYLIST,
|
---|
| 2913 | LM_DELETEITEM,
|
---|
| 2914 | MPFROM2SHORT(keyindex,0),
|
---|
| 2915 | MPVOID);
|
---|
| 2916 | WinSendMsg(hwnd,UM_SETDIR,MPVOID,MPVOID);
|
---|
| 2917 | sSel = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2918 | INI_KEYLIST,
|
---|
| 2919 | LM_QUERYITEMCOUNT,
|
---|
| 2920 | MPVOID,
|
---|
| 2921 | MPVOID);
|
---|
| 2922 | if(!sSel)
|
---|
| 2923 | WinSendMsg(hwnd,
|
---|
| 2924 | INI_DELETEAPP,
|
---|
| 2925 | MPVOID,
|
---|
| 2926 | MPVOID);
|
---|
| 2927 | else {
|
---|
| 2928 | sSel = min(keyindex,sSel - 1);
|
---|
| 2929 | WinSendDlgItemMsg(hwnd,
|
---|
| 2930 | INI_KEYLIST,
|
---|
| 2931 | LM_SELECTITEM,
|
---|
| 2932 | MPFROMSHORT(sSel),
|
---|
| 2933 | MPFROMSHORT(TRUE));
|
---|
| 2934 | }
|
---|
| 2935 | }
|
---|
| 2936 | break;
|
---|
| 2937 |
|
---|
| 2938 | case INI_DELETEAPP:
|
---|
| 2939 | inidata = INSTDATA(hwnd);
|
---|
| 2940 | if(inidata && *inidata->applname) {
|
---|
| 2941 |
|
---|
| 2942 | SHORT appindex = inidata->appindex;
|
---|
| 2943 |
|
---|
| 2944 | if(inidata->confirm && saymsg(MB_YESNO,
|
---|
| 2945 | hwnd,
|
---|
| 2946 | GetPString(IDS_CONFIRMTEXT),
|
---|
| 2947 | GetPString(IDS_INIDELETEAPPTEXT),
|
---|
| 2948 | inidata->applname) ==
|
---|
| 2949 | MBID_NO)
|
---|
| 2950 | break;
|
---|
| 2951 | PrfWriteProfileData(inidata->hini,
|
---|
| 2952 | inidata->applname,
|
---|
| 2953 | NULL,
|
---|
| 2954 | NULL,
|
---|
| 2955 | 0L);
|
---|
| 2956 | *inidata->applname = *inidata->keyname = 0;
|
---|
| 2957 | WinSendMsg(hwnd,
|
---|
| 2958 | UM_SETDIR,
|
---|
| 2959 | MPVOID,
|
---|
| 2960 | MPVOID);
|
---|
| 2961 | WinSendDlgItemMsg(hwnd,
|
---|
| 2962 | INI_KEYLIST,
|
---|
| 2963 | LM_DELETEALL,
|
---|
| 2964 | MPVOID,
|
---|
| 2965 | MPVOID);
|
---|
| 2966 | WinSendDlgItemMsg(hwnd,
|
---|
| 2967 | INI_APPLIST,
|
---|
| 2968 | LM_DELETEITEM,
|
---|
| 2969 | MPFROM2SHORT(appindex,0),
|
---|
| 2970 | MPVOID);
|
---|
| 2971 | WinSendMsg(hwnd,
|
---|
| 2972 | UM_SETDIR,
|
---|
| 2973 | MPVOID,
|
---|
| 2974 | MPVOID);
|
---|
| 2975 | sSel = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
| 2976 | INI_APPLIST,
|
---|
| 2977 | LM_QUERYITEMCOUNT,
|
---|
| 2978 | MPVOID,
|
---|
| 2979 | MPVOID);
|
---|
| 2980 | if(sSel) {
|
---|
| 2981 | sSel = min(appindex,sSel - 1);
|
---|
| 2982 | WinSendDlgItemMsg(hwnd,
|
---|
| 2983 | INI_APPLIST,
|
---|
| 2984 | LM_SELECTITEM,
|
---|
| 2985 | MPFROMSHORT(sSel),
|
---|
| 2986 | MPFROMSHORT(TRUE));
|
---|
| 2987 | }
|
---|
| 2988 | }
|
---|
| 2989 | break;
|
---|
| 2990 |
|
---|
| 2991 | case DID_OK:
|
---|
| 2992 | case DID_CANCEL:
|
---|
| 2993 | PostMsg(hwnd,
|
---|
| 2994 | WM_CLOSE,
|
---|
| 2995 | MPVOID,
|
---|
| 2996 | MPVOID);
|
---|
| 2997 | break;
|
---|
| 2998 |
|
---|
| 2999 | case IDM_HELP:
|
---|
| 3000 | if(hwndHelp)
|
---|
| 3001 | WinSendMsg(hwndHelp,
|
---|
| 3002 | HM_DISPLAY_HELP,
|
---|
| 3003 | MPFROM2SHORT(HELP_INI,0),
|
---|
| 3004 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 3005 | break;
|
---|
| 3006 |
|
---|
| 3007 | case IDM_ABOUT:
|
---|
| 3008 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 3009 | hwnd,
|
---|
| 3010 | GetPString(IDS_VIEWABOUTTITLETEXT),
|
---|
| 3011 | GetPString(IDS_INIABOUTTEXT));
|
---|
| 3012 | break;
|
---|
| 3013 | }
|
---|
| 3014 | return 0;
|
---|
| 3015 |
|
---|
| 3016 | case WM_CLOSE:
|
---|
| 3017 | if(ParentIsDesktop(WinQueryWindow(hwnd,QW_PARENT),(HWND)0)) {
|
---|
| 3018 |
|
---|
| 3019 | SWP swp;
|
---|
| 3020 |
|
---|
| 3021 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
| 3022 | if(!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3023 | WinStoreWindowPos(FM2Str,
|
---|
| 3024 | "INIWindowPos",
|
---|
| 3025 | WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 3026 | inidata = WinQueryWindowPtr(hwnd,0);
|
---|
| 3027 | }
|
---|
| 3028 | WinDestroyWindow(WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 3029 | return 0;
|
---|
| 3030 |
|
---|
| 3031 | case WM_DESTROY:
|
---|
| 3032 | inidata = INSTDATA(hwnd);
|
---|
| 3033 | {
|
---|
| 3034 | BOOL dontclose = FALSE;
|
---|
| 3035 |
|
---|
| 3036 | if(inidata) {
|
---|
| 3037 | dontclose = inidata->dontclose;
|
---|
| 3038 | if(inidata->hini)
|
---|
| 3039 | PrfCloseProfile(inidata->hini);
|
---|
| 3040 | if(inidata->data)
|
---|
| 3041 | free(inidata->data);
|
---|
| 3042 | if(inidata->hwndPopup)
|
---|
| 3043 | WinDestroyWindow(inidata->hwndPopup);
|
---|
| 3044 | free(inidata);
|
---|
| 3045 | }
|
---|
| 3046 | if(!dontclose &&
|
---|
| 3047 | ParentIsDesktop(hwnd,WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 3048 | QW_PARENT),
|
---|
| 3049 | QW_PARENT))) {
|
---|
| 3050 | if(!PostMsg((HWND)0,
|
---|
| 3051 | WM_QUIT,
|
---|
| 3052 | MPVOID,
|
---|
| 3053 | MPVOID))
|
---|
| 3054 | DosExit(EXIT_PROCESS,1);
|
---|
| 3055 | }
|
---|
| 3056 | }
|
---|
| 3057 | break;
|
---|
| 3058 | }
|
---|
| 3059 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 3060 | }
|
---|
| 3061 |
|
---|