473,231 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

plzzzz help

code of win32.h header file in c++
Jul 4 '06 #1
2 1790
9,065 Expert Mod 8TB
I'm not aware of any such file, you had better tell us what development environment it comes from.
Jul 4 '06 #2
code of win32.h header file in c++

well this is the code if you want it

* OpenVPN -- An application to securely tunnel IP networks
* over a single UDP port, with support for SSL/TLS-based
* session authentication and key exchange,
* packet encryption, packet authentication, and
* packet compression.
* Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING included with this
* distribution); if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#ifdef WIN32
#ifndef OPENVPN_WIN32_H
#define OPENVPN_WIN32_H

#include "mtu.h"

* Win32-specific OpenVPN code, targetted at the mingw
* development environment.

void init_win32 (void);
void uninit_win32 (void);

void set_pause_exit_win32 (void);

* Use keyboard input or events
* to simulate incoming signals

#define SIGUSR1 1
#define SIGUSR2 2
#define SIGHUP 3
#define SIGTERM 4
#define SIGINT 5

struct security_attributes

#define HANDLE_DEFINED(h) ((h) != NULL && (h) != INVALID_HANDLE_VALUE)

* Save old window title.
struct window_title
bool saved;
char old_window_title [256];

struct rw_handle {
HANDLE read;
HANDLE write;

* Event-based notification of incoming TCP connections

#define NE32_PERSIST_EVENT (1<<0)
#define NE32_WRITE_EVENT (1<<1)

static inline bool
defined_net_event_win32 (const struct rw_handle *event)
return event->read != NULL;

void init_net_event_win32 (struct rw_handle *event, long network_events, socket_descriptor_t sd, unsigned int flags);
long reset_net_event_win32 (struct rw_handle *event, socket_descriptor_t sd);
void close_net_event_win32 (struct rw_handle *event, socket_descriptor_t sd, unsigned int flags);

* A stateful variant of the net_event_win32 functions above

struct net_event_win32
struct rw_handle handle;
socket_descriptor_t sd;
long event_mask;

void net_event_win32_init (struct net_event_win32 *ne);
void net_event_win32_start (struct net_event_win32 *ne, long network_events, socket_descriptor_t sd);
void net_event_win32_reset (struct net_event_win32 *ne);
void net_event_win32_reset_write (struct net_event_win32 *ne);
void net_event_win32_stop (struct net_event_win32 *ne);
void net_event_win32_close (struct net_event_win32 *ne);

static bool
net_event_win32_defined (const struct net_event_win32 *ne)
return defined_net_event_win32 (&ne->handle);

static inline struct rw_handle *
net_event_win32_get_event (struct net_event_win32 *ne)
return &ne->handle;

static inline long
net_event_win32_get_event_mask (const struct net_event_win32 *ne)
return ne->event_mask;

static inline void
net_event_win32_clear_selected_events (struct net_event_win32 *ne, long selected_events)
ne->event_mask &= ~selected_events;

* Signal handling
struct win32_signal {
# define WSO_MODE_UNDEF 0
int mode;
struct rw_handle in;
DWORD console_mode_save;
bool console_mode_save_defined;

extern struct win32_signal win32_signal; /* static/global */
extern struct window_title window_title; /* static/global */

void win32_signal_clear (struct win32_signal *ws);

/* win32_signal_open startup type */
#define WSO_NOFORCE 0

void win32_signal_open (struct win32_signal *ws,
int force, /* set to WSO force parm */
const char *exit_event_name,
bool exit_event_initial_state);

void win32_signal_close (struct win32_signal *ws);

int win32_signal_get (struct win32_signal *ws);

void win32_pause (struct win32_signal *ws);

* Set the text on the window title bar

void window_title_clear (struct window_title *wt);
void window_title_save (struct window_title *wt);
void window_title_restore (const struct window_title *wt);
void window_title_generate (const char *title);

* We try to do all Win32 I/O using overlapped
* (i.e. asynchronous) I/O for a performance win.
struct overlapped_io {
# define IOSTATE_QUEUED 1 /* overlapped I/O has been queued */
# define IOSTATE_IMMEDIATE_RETURN 2 /* I/O function returned immediately without queueing */
int iostate;
OVERLAPPED overlapped;
DWORD size;
DWORD flags;
int status;
bool addr_defined;
struct sockaddr_in addr;
int addrlen;
struct buffer buf_init;
struct buffer buf;

void overlapped_io_init (struct overlapped_io *o,
const struct frame *frame,
BOOL event_state,
bool tuntap_buffer);

void overlapped_io_close (struct overlapped_io *o);

static inline bool
overlapped_io_active (struct overlapped_io *o)
return o->iostate == IOSTATE_QUEUED || o->iostate == IOSTATE_IMMEDIATE_RETURN;

char *overlapped_io_state_ascii (const struct overlapped_io *o);

* Use to control access to resources that only one
* OpenVPN process on a given machine can access at
* a given time.

struct semaphore
const char *name;
bool locked;
HANDLE hand;

void semaphore_clear (struct semaphore *s);
void semaphore_open (struct semaphore *s, const char *name);
bool semaphore_lock (struct semaphore *s, int timeout_milliseconds);
void semaphore_release (struct semaphore *s);
void semaphore_close (struct semaphore *s);

* Special global semaphore used to protect network
* shell commands from simultaneous instantiation.
* It seems you can't run more than one instance
* of netsh on the same machine at the same time.

extern struct semaphore netcmd_semaphore;
void netcmd_semaphore_init (void);
void netcmd_semaphore_close (void);
void netcmd_semaphore_lock (void);
void netcmd_semaphore_release (void);

bool get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity);
char *getpass (const char *prompt);

/* Set Win32 security attributes structure to allow all access */
bool init_security_attributes_allow_all (struct security_attributes *obj);

Jul 5 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both...
by: biltz | last post by:
i want function prototype of calculator..i made the calculator source code and now i want to insert dis source code into other program... as there is a function prototype of maths table..that is ...
by: shakthi | last post by:
Hi all, Am new to MFC appilcation programming.Plese tell me how to display a file with its path that is chosen from a file dialog.Am trying to create a dialog box displaying a list of...
by: anniejacob | last post by:
hi, i need lil help.i want to make a winform in C# in which i have to make a grouppanel which looks the same like the toolbox in the microsoft visual studio. i want to pick up labels from...
by: vidhyapriya | last post by:
hi i m using crystal report in vb.net...In button click i m using another form to view crystal report viewer..whenever i click the button the pages r added...first time i click button the total...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.