1 /* @(#) $Id: ./src/win32/setup-win.c, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
14 #include "setup-shared.h"
17 /* Setup windows after install */
18 int main(int argc, char **argv)
22 printf("%s: Invalid syntax.\n", argv[0]);
23 printf("Try: '%s directory'\n\n", argv[0]);
27 /* Trying to chdir to ossec directory. */
28 if(chdir(argv[1]) != 0)
30 printf("%s: Invalid directory: '%s'.\n", argv[0], argv[1]);
34 /* Checking if ossec was installed already (upgrade) */
35 if(!fileexist(OSSECCONF))
37 char cmd[OS_MAXSTR +1];
39 /* Copy default config to ossec.conf */
40 snprintf(cmd, OS_MAXSTR, "copy %s %s", OSSECDEF, OSSECCONF);
45 /* Setting up local files */
46 system("add-localfile.exe \"C:\\Windows\\pfirewall.log\" --quiet");
47 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");
50 /* Configure ossec for automatic startup */
51 system("sc config OssecSvc start= auto");
54 /* Changing permissions. */
60 char cmd[OS_MAXSTR +1];
62 /* Copy some files to outside */
63 snprintf(cmd, OS_MAXSTR, "move os_win32ui.exe ../");
66 snprintf(cmd, OS_MAXSTR, "move win32ui.exe ../");
69 snprintf(cmd, OS_MAXSTR, "move uninstall.exe ../");
72 snprintf(cmd, OS_MAXSTR, "move doc.html ../");
75 snprintf(cmd, OS_MAXSTR, "move help.txt ../");
79 /* Changing permissions. */
80 system("echo y|cacls * /T /G Administrators:f ");
83 /* Copying them back. */
84 snprintf(cmd, OS_MAXSTR, "move ..\\os_win32ui.exe .");
87 snprintf(cmd, OS_MAXSTR, "move ..\\win32ui.exe .");
90 snprintf(cmd, OS_MAXSTR, "move ..\\uninstall.exe .");
93 snprintf(cmd, OS_MAXSTR, "move ..\\doc.html .");
96 snprintf(cmd, OS_MAXSTR, "move ..\\help.txt .");
101 system("echo y|cacls . /T /G Administrators:f ");