Crossfire Server, Branches 1.12  R18729
win32.c File Reference
#include <global.h>
#include <stdarg.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
#include <mmsystem.h>
#include <winsvc.h>
+ Include dependency graph for win32.c:

Go to the source code of this file.

Data Structures

struct  timezone
 

Macros

#define SERVICE_DESCRIPTION   "Crossfire is a multiplayer online RPG game."
 
#define SERVICE_DISPLAY   "Crossfire server"
 
#define SERVICE_NAME   "Crossfire"
 

Functions

int closedir (DIR *dp)
 
int gettimeofday (struct timeval *time_Info, struct timezone *timezone_Info)
 
int main (int argc, char **argv)
 
DIRopendir (const char *dir)
 
struct direntreaddir (DIR *dp)
 
void rewinddir (DIR *dir_Info)
 
void service_handle ()
 
void service_register ()
 
void service_unregister ()
 
void WINAPI ServiceCtrlHandler (DWORD Opcode)
 
void WINAPI ServiceMain (DWORD argc, LPTSTR *argv)
 

Variables

int bRunning
 
SERVICE_STATUS m_ServiceStatus
 
SERVICE_STATUS_HANDLE m_ServiceStatusHandle
 

Detailed Description

Windows-related compatibility functions.

This file should probably not be used apart under Windows.

Definition in file win32.c.

Macro Definition Documentation

#define SERVICE_DESCRIPTION   "Crossfire is a multiplayer online RPG game."

Description of the service.

Definition at line 213 of file win32.c.

Referenced by service_register().

#define SERVICE_DISPLAY   "Crossfire server"

Name that will appear in the service list.

Definition at line 211 of file win32.c.

Referenced by service_register().

#define SERVICE_NAME   "Crossfire"

Internal name of the service.

Definition at line 209 of file win32.c.

Referenced by service_handle(), service_register(), service_unregister(), and ServiceMain().

Function Documentation

int closedir ( DIR dp)

Dispose of a directory handle.

Parameters
dphandle to free. Will become invalid.
Returns
0.

Definition at line 149 of file win32.c.

References DIR::dir, and DIR::handle.

Referenced by command_players(), find_maps(), help_topics(), initPlugins(), load_dir(), and remove_directory().

+ Here is the caller graph for this function:

int gettimeofday ( struct timeval *  time_Info,
struct timezone timezone_Info 
)

Gets the time of the day.

Parameters
[out]time_Infowill receive the time of the day.
[out]timezone_Infowill receive the timezone info.
Returns
0.

Definition at line 54 of file win32.c.

References timezone::tz_dsttime, and timezone::tz_minuteswest.

Referenced by generate_random_map(), and ready_map_name().

+ Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Main entry point.

Parameters
argclength of argv.
argvcommand-line options.
Returns
0.

Definition at line 50 of file devel.c.

References add_string(), add_type_to_attribute(), type_definition::attribute_count, attribute_count, cached_pics, cf_parameter_list_size, color_blocking, color_linked_exit, color_road, color_slowing, color_unlinked_exit, struct_map_list::count, create_destination(), created_pics, Settings::debug, type_definition::description, do_parameters(), do_regions_link, dump_unused_maps(), elevation_info, elevation_max, elevation_min, facesets, regiondef::fallback, fallback_type, find_maps(), first_map_path, first_region, fix_exits_to_tiled_maps(), fix_map_names(), fix_tiled_map(), fix_tiled_map_monsters(), force_pics, found_maps, found_maps_count, gdfaces, generate_index, generate_pics, get_attribute(), get_map_info(), get_region_struct(), get_type_definition(), index_letter, index_map, index_quest_template, index_region_region_template, index_region_template, index_template, infomap, CREPixmap::init(), init_archetypes(), init_artifacts(), init_formulae(), init_globals(), init_gods(), init_library(), init_map_list(), init_race_list(), init_readable(), init_regions(), is_custom_attribute(), is_valid_faceset(), jpeg_quality, level_map_template, level_template, level_value_template, LIBDIR, list_unused_maps, load_treasures(), regiondef::longname, map_exit_template, map_exit_to_template, map_limit, map_lore_template, map_monster_after_template, map_monster_before_template, map_monster_between_template, map_monster_one_template, map_no_exit_template, map_no_exit_to_template, map_no_lore_template, map_no_monster_template, map_no_quest_template, map_one_quest_template, map_template, map_with_exit_template, map_with_exit_to_template, map_with_quests_template, struct_map_list::maps, type_definition::name, regiondef::name, regiondef::next, nrofpixmaps, type_definition::number, OBJECT_TYPE_MAX, OF_JPG, output_extensions, output_format, pics_allocated, process_map(), quest_map_template, quest_template, rawmaps, read_client_images(), read_ignore_list(), read_line(), read_template(), read_type(), region_letter_template, region_map_template, region_template, root, server_main(), settings, show_maps, snprintf(), sortbyname(), tileset, type_count, warn_no_path, world_exit_info, world_map, world_map_template, world_row_template, world_template, write_all_maps(), write_all_regions(), write_attribute_file(), write_equipment_index(), write_maps_by_level(), write_maps_index(), write_npc_list(), write_quests_page(), write_race_index(), write_region_index(), write_regions_link(), write_slaying_info(), write_tiled_maps(), write_type_file(), write_type_index(), write_world_info(), write_world_map(), and yesno().

Referenced by ServiceMain().

+ Here is the caller graph for this function:

DIR* opendir ( const char *  dir)

Opens a directory for reading. The handle should be disposed through closedir().

Parameters
dirdirectory path.
Returns
directory handle, NULL if failure.

Definition at line 78 of file win32.c.

References DIR::dir, DIR::fileinfo, DIR::finished, DIR::handle, and DIR::offset.

Referenced by command_players(), find_maps(), help_topics(), initPlugins(), load_dir(), and remove_directory().

+ Here is the caller graph for this function:

struct dirent* readdir ( DIR dp)

Returns the next file/directory for specified directory handle, obtained through a call to opendir().

Parameters
dphandle.
Returns
next file/directory, NULL if end reached.

Definition at line 116 of file win32.c.

References dirent::d_ino, dirent::d_name, dirent::d_off, dirent::d_reclen, DIR::dent, DIR::fileinfo, DIR::finished, DIR::handle, and DIR::offset.

Referenced by command_players(), find_maps(), help_topics(), initPlugins(), load_dir(), and remove_directory().

+ Here is the caller graph for this function:

void rewinddir ( DIR dir_Info)

Restart a directory listing from the beginning.

Parameters
dir_Infohandle to rewing.

Definition at line 167 of file win32.c.

References DIR::dir, DIR::fileinfo, DIR::finished, DIR::handle, and DIR::offset.

void service_handle ( )

Service entry point.

Definition at line 384 of file win32.c.

References SERVICE_NAME, and ServiceMain().

+ Here is the call graph for this function:

void service_register ( )

Registers the server to the service manager.

See Also
service_unregister().

Definition at line 221 of file win32.c.

References SERVICE_DESCRIPTION, SERVICE_DISPLAY, and SERVICE_NAME.

void service_unregister ( )

Removes the Crossfire service from the service manager.

See Also
service_register().

Definition at line 266 of file win32.c.

References SERVICE_NAME.

void WINAPI ServiceCtrlHandler ( DWORD  Opcode)

Main service dispatch routine.

Parameters
Opcodeservice operation, like pause/start/stop.

Definition at line 308 of file win32.c.

References bRunning, llevInfo, LOG(), m_ServiceStatus, and m_ServiceStatusHandle.

Referenced by ServiceMain().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WINAPI ServiceMain ( DWORD  argc,
LPTSTR *  argv 
)

Main service entrypoint.

Parameters
argc
argvarguments to the service.

Definition at line 347 of file win32.c.

References bRunning, m_ServiceStatus, m_ServiceStatusHandle, main(), SERVICE_NAME, and ServiceCtrlHandler().

Referenced by service_handle().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

int bRunning

Will be set to FALSE when the server should stop running because the service is turned off.

Definition at line 202 of file win32.c.

Referenced by server_main(), ServiceCtrlHandler(), and ServiceMain().

SERVICE_STATUS m_ServiceStatus

Definition at line 206 of file win32.c.

Referenced by ServiceCtrlHandler(), and ServiceMain().

SERVICE_STATUS_HANDLE m_ServiceStatusHandle

Definition at line 207 of file win32.c.

Referenced by ServiceCtrlHandler(), and ServiceMain().