Changeset 229 for trunk/src/helpers/prfh2.c
- Timestamp:
- Nov 24, 2002, 9:45:05 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/prfh2.c
r169 r229 42 42 #define INCL_DOSERRORS 43 43 #define INCL_WINSHELLDATA 44 #define INCL_WINERRORS 44 45 #include <os2.h> 45 46 … … 54 55 55 56 #include "helpers\prfh.h" 57 #include "helpers\xprf.h" 56 58 57 59 #pragma hdrstop … … 641 643 } 642 644 643 645 #ifdef __PRFH2_MAIN__ 646 647 int main(int argc, char* argv[]) 648 { 649 APIRET arc = NO_ERROR; 650 PCSZ pcszSource, 651 pcszTarget, 652 pcszApp; 653 PXINI piniSource; 654 HINI hiniTarget; 655 BOOL fCloseSource = FALSE, 656 fCloseTarget = FALSE; 657 HAB hab = WinInitialize(0); 658 CHAR szFailing[1000]; 659 660 if (argc < 4) 661 { 662 printf("%d\nprfh2 <sourcefile> <targetfile> <appname>\n", argc); 663 exit(2); 664 } 665 666 pcszSource = argv[1]; 667 pcszTarget = argv[2]; 668 pcszApp = argv[3]; 669 670 if (arc = xprfOpenProfile(pcszSource, 671 &piniSource)) 672 { 673 printf("xprfOpenProfile returned %d opening source INI \"%s\"\n", 674 arc, 675 pcszSource); 676 } 677 else 678 fCloseSource = TRUE; 679 680 if (!strcmp(pcszTarget, "USER")) 681 hiniTarget = HINI_USER; 682 else if (!strcmp(pcszTarget, "SYSTEM")) 683 hiniTarget = HINI_SYSTEM; 684 else 685 { 686 if (!(hiniTarget = PrfOpenProfile(hab, (PSZ)pcszTarget))) 687 { 688 printf("Cannot open source INI \"%s\"\n", pcszTarget); 689 arc = -1; 690 } 691 else 692 fCloseTarget = TRUE; 693 } 694 695 if (!arc) 696 { 697 if (arc = xprfCopyApp2(piniSource, 698 pcszApp, 699 hiniTarget, 700 pcszApp, 701 szFailing)) 702 { 703 printf("Error %d copying application \"%s\" from %s to %s\n", 704 arc, 705 pcszApp, 706 pcszSource, 707 pcszTarget); 708 printf("Failing key: \"%s\"\n", 709 szFailing); 710 } 711 else 712 printf("Application \"%s\" successfully copied from %s to %s\n", 713 pcszApp, 714 pcszSource, 715 pcszTarget); 716 } 717 718 if (arc) 719 { 720 ERRORID eid; 721 eid = WinGetLastError(hab); 722 723 printf("WinGetLastError returned 0x%lX\n", 724 eid); 725 } 726 727 728 if (fCloseSource) 729 xprfCloseProfile(piniSource); 730 if (fCloseTarget) 731 PrfCloseProfile(hiniTarget); 732 733 WinTerminate(hab); 734 735 exit(arc); 736 } 737 738 #endif
Note:
See TracChangeset
for help on using the changeset viewer.