1 /* @(#) $Id: setup-win.c,v 1.42 2009/06/24 18:53:10 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
13 #include "setup-shared.h"
16 /* Setup windows after install */
17 int main(int argc, char **argv)
21 printf("%s: Invalid syntax.\n", argv[0]);
22 printf("Try: '%s directory'\n\n", argv[0]);
26 /* Trying to chdir to ossec directory. */
27 if(chdir(argv[1]) != 0)
29 printf("%s: Invalid directory: '%s'.\n", argv[0], argv[1]);
33 /* Checking if ossec was installed already (upgrade) */
34 if(!fileexist(OSSECCONF))
36 char cmd[OS_MAXSTR +1];
38 /* Copy default config to ossec.conf */
39 snprintf(cmd, OS_MAXSTR, "copy %s %s", OSSECDEF, OSSECCONF);
44 /* Setting up local files */
45 system("add-localfile.exe \"C:\\Windows\\pfirewall.log\" --quiet");
46 system("add-localfile.exe \"C:\\Documents and Settings\\All Users\\Application Data\\Symantec\\Symantec AntiVirus Corporate Edition\\7.5\\Logs\\\%m\%d20\%y.log\" --quiet");
49 /* Configure ossec for automatic startup */
50 system("sc config OssecSvc start= auto");
53 /* Changing permissions. */
59 char cmd[OS_MAXSTR +1];
61 /* Copy some files to outside */
62 snprintf(cmd, OS_MAXSTR, "move os_win32ui.exe ../");
65 snprintf(cmd, OS_MAXSTR, "move win32ui.exe ../");
68 snprintf(cmd, OS_MAXSTR, "move uninstall.exe ../");
71 snprintf(cmd, OS_MAXSTR, "move doc.html ../");
74 snprintf(cmd, OS_MAXSTR, "move help.txt ../");
78 /* Changing permissions. */
79 system("echo y|cacls * /T /G Administrators:f ");
82 /* Copying them back. */
83 snprintf(cmd, OS_MAXSTR, "move ..\\os_win32ui.exe .");
86 snprintf(cmd, OS_MAXSTR, "move ..\\win32ui.exe .");
89 snprintf(cmd, OS_MAXSTR, "move ..\\uninstall.exe .");
92 snprintf(cmd, OS_MAXSTR, "move ..\\doc.html .");
95 snprintf(cmd, OS_MAXSTR, "move ..\\help.txt .");
100 system("echo y|cacls . /T /G Administrators:f ");