Window service related changes

git-svn-id: http://voip.null.ro/svn/yate@374 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-05-24 14:42:01 +00:00
parent 177b07cd8e
commit e50cf93998
7 changed files with 191 additions and 7 deletions

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/yate-client.exe"
# ADD LINK32 kernel32.lib user32.lib comctl32.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /machine:I386 /out:"Release/yate-client.exe"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "Client - Win32 Debug"
@ -64,14 +64,14 @@ LINK32=link.exe
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_MFC 1
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -82,7 +82,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"Debug/yate-client.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib comctl32.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /incremental:no /debug /machine:I386 /out:"Debug/yate-client.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
@ -102,13 +102,21 @@ SOURCE=".\main-client.cpp"
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\version.rc
SOURCE=.\client.rc
# End Source File
# Begin Source File
SOURCE=.\null_team.ico
# End Source File
# End Group
# End Target

87
windows/client.rc Normal file
View File

@ -0,0 +1,87 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""version.rc""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_TCLIENT DIALOGEX 0, 0, 261, 178
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Yate"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,0,0,261,165
LTEXT "",IDC_STATUS,2,166,257,10,0,WS_EX_STATICEDGE
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_NULLTEAM ICON DISCARDABLE "null_team.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "version.rc"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -22,7 +22,68 @@
#include "yatengine.h"
#include "resource.h"
#include <commctrl.h>
using namespace TelEngine;
class WinClientThread : public Thread
{
public:
void run();
};
class WinClientPlugin : public Plugin
{
public:
WinClientPlugin()
: m_thread(0)
{ }
virtual void initialize(void);
virtual bool isBusy() const
{ return true; }
private:
WinClientThread* m_thread;
};
int CALLBACK mainDialog(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
{
switch (msg) {
case WM_CLOSE:
EndDialog(wnd,1);
break;
default:
return 0;
}
return 1;
}
void WinClientThread::run()
{
InitCommonControls();
int ret = DialogBox(0,MAKEINTRESOURCE(IDD_TCLIENT),0,mainDialog);
if (ret < 0)
ret = 127;
Engine::halt(ret);
}
void WinClientPlugin::initialize()
{
if (!m_thread) {
m_thread = new WinClientThread;
if (m_thread->error())
Engine::halt(1);
else
m_thread->startup();
}
}
INIT_PLUGIN(WinClientPlugin);
// We force mainCRTStartup as entry point (from linker settings) so we get
// the parser called even for a GUI application
extern "C" int main(int argc, const char** argv, const char** envp)
{
return TelEngine::Engine::main(argc,argv,envp,TelEngine::Engine::Client);
return Engine::main(argc,argv,envp,TelEngine::Engine::Client);
}

BIN
windows/null_team.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

21
windows/resource.h Normal file
View File

@ -0,0 +1,21 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Client.rc
//
#define IDD_DIALOG1 101
#define IDD_TCLIENT 101
#define IDI_NULLTEAM 102
#define IDC_TAB1 1000
#define IDC_STATUS 1001
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -53,11 +53,13 @@ Source: "Release\wavefile.yate"; DestDir: "{app}\modules"; Components: driver\ba
Source: "Release\wpchan.yate"; DestDir: "{app}\modules"; Components: driver\wp
Source: "Release\yrtpchan.yate"; DestDir: "{app}\modules"; Components: driver\sip
Source: "Release\ysipchan.yate"; DestDir: "{app}\modules"; Components: driver\sip
Source: "..\conf.d\ysipchan.conf"; DestDir: "{app}\conf.d"
Source: "..\conf.d\*.conf.sample"; DestDir: "{app}\conf.d"
[Icons]
Name: "{group}\Yate Client"; Filename: "{app}\yate-client.exe"; Components: client
Name: "{group}\Yate Console"; Filename: "{app}\yate-console.exe"; Components: debug
Name: "{group}\Register Service"; Filename: "{app}\yate-service.exe"; Parameters: "--install"; Components: server
Name: "{group}\Unregister Service"; Filename: "{app}\yate-service.exe"; Parameters: "--remove"; Components: server
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Yate Client"; Filename: "{app}\yate-client.exe"; Components: client; Tasks: qlaunch
Name: "{userdesktop}\Yate Client"; Filename: "{app}\yate-client.exe"; Components: client; Tasks: desktop
@ -65,3 +67,6 @@ Name: "{userdesktop}\Yate Client"; Filename: "{app}\yate-client.exe"; Components
[Run]
Filename: "{app}\yate-client.exe"; Description: "Launch client"; Components: client; Flags: postinstall nowait skipifsilent unchecked
[UninstallRun]
Filename: "{app}\yate-service.exe"; Parameters: "--remove"; Components: server

View File

@ -44,6 +44,7 @@
#include <windows.h>
#include <io.h>
#include <direct.h>
/**
* Windows definitions for commonly used types
@ -75,6 +76,7 @@ typedef unsigned long in_addr_t;
#define write _write
#define close _close
#define getpid _getpid
#define chdir _chdir
#define O_RDWR _O_RDWR
#define O_RDONLY _O_RDONLY