+ #else
+
+ /* Get full path to the directory this
+ * executable lives in
+ */
+ ret = GetModuleFileName(NULL, path, sizeof(path));
+
+ /* check for errors */
+ if(!ret)
+ {
+ ErrorExit(GMF_ERROR);
+ }
+
+ /* Get last error */
+ last_error = GetLastError();
+
+ /* Look for errors */
+ if(last_error != ERROR_SUCCESS)
+ {
+ if(last_error == ERROR_INSUFFICIENT_BUFFER)
+ {
+ ErrorExit(GMF_BUFF_ERROR, ret, sizeof(path));
+ }
+ else
+ {
+ ErrorExit(GMF_UNKN_ERROR, last_error);
+ }
+ }
+
+ /* Remove file name from path */
+ PathRemoveFileSpec(path);
+
+ /* Move to correct directory */
+ if(chdir(path))
+ {
+ ErrorExit(CHDIR_ERROR, path);
+ }
+
+ /* Check permissions */
+ fp = fopen(OSSECCONF, "r");
+ if(fp)
+ {
+ fclose(fp);
+ }
+ else
+ {
+ ErrorExit(CONF_ERROR, OSSECCONF);
+ }
+
+ #endif