summaryrefslogtreecommitdiffstats
path: root/private/nw/install/setupdll/removesz.c
diff options
context:
space:
mode:
Diffstat (limited to 'private/nw/install/setupdll/removesz.c')
-rw-r--r--private/nw/install/setupdll/removesz.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/private/nw/install/setupdll/removesz.c b/private/nw/install/setupdll/removesz.c
new file mode 100644
index 000000000..00757ae6f
--- /dev/null
+++ b/private/nw/install/setupdll/removesz.c
@@ -0,0 +1,58 @@
+/*++
+Copyright (c) 1990 Microsoft Corporation
+
+RemoveSzFromFile() - remove a specified string from the file
+
+--*/
+
+#include <nt.h>
+#include <ntrtl.h>
+#include <nturtl.h>
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <nwcfg.hxx>
+
+
+BOOL
+RemoveSzFromFile( DWORD nArgs, LPSTR apszArgs[], LPSTR * ppszResult )
+{
+ FILE * hsrcfile;
+ FILE * hdesfile;
+ char * pszTempname;
+ char szInput[1000];
+
+ pszTempname = tmpnam(NULL);
+ wsprintf(achBuff,"{1}");
+ *ppszResult = achBuff;
+ if ( nArgs != 2 )
+ {
+ return(FALSE);
+ }
+ hsrcfile = fopen(apszArgs[0],"r");
+ hdesfile = fopen(pszTempname,"w");
+ if (( hsrcfile != NULL ) && ( hdesfile != NULL ))
+ {
+ while (fgets(szInput,1000,hsrcfile))
+ {
+ if (_stricmp(szInput,apszArgs[1])!=0)
+ {
+ fputs(szInput,hdesfile);
+ }
+ }
+ }
+ if ( hsrcfile != NULL )
+ fclose(hsrcfile);
+ if ( hdesfile != NULL )
+ fclose(hdesfile);
+ if (( hsrcfile != NULL ) && ( hdesfile != NULL ))
+ {
+ CopyFileA(pszTempname,apszArgs[0], FALSE);
+ DeleteFileA(pszTempname);
+ }
+
+ wsprintf(achBuff,"{0}");
+ *ppszResult = achBuff;
+ return(TRUE);
+}