char str[128],fname[256],idStr[128];
- sprintf(str,"http://localhost:%d",servMgr->serverHost.port);
+ sprintf(str,"http://127.0.0.1:%d",servMgr->serverHost.port);
info.id.toStr(idStr);
PlayList::TYPE type;
#if 1 /* for VP extend version */
//#define VERSION_EX 1
static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
-static const int PCP_CLIENT_VERSION_EX_NUMBER = 32;
-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0032)";
-static const char *PCX_VERSTRING_EX = "v0.1218(IM0032)";
+static const int PCP_CLIENT_VERSION_EX_NUMBER = 33;
+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0033)";
+static const char *PCX_VERSTRING_EX = "v0.1218(IM0033)";
#endif
// ------------------------------------------------
void WSys::callLocalURL(const char *str,int port)
{
char cmd[512];
- sprintf(cmd,"http://localhost:%d/%s",port,str);
+ sprintf(cmd,"http://127.0.0.1:%d/%s",port,str);
ShellExecute(mainWindow, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
}
va_end(ap);
}
+// --------------------------------------------------
+void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
+{
+ //hInst = hInstance;
+
+ version_ex = 1; // PP\94Å\8ag\92£\8b@\94\\82ð\96³\8cø\82É\81©\91å\89R\81B\83o\81[\83W\83\87\83\93\95\\8bL\82ðEX\82É
+
+ //iniFileName.set(".\\peercast.ini");
+
+ WIN32_FIND_DATA fd; //JP-EX
+ HANDLE hFind; //JP-EX
+
+ OSVERSIONINFO osInfo; //JP-EX
+ osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); //JP-EX
+ GetVersionEx(&osInfo);
+ if (osInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ winDistinctionNT = true;
+ else
+ winDistinctionNT = false;
+
+ // off by default now
+ showGUI = false;
+
+ // get current path
+ {
+ TCHAR buf[1024];
+ DWORD ret;
+
+ ret = GetModuleFileName(NULL, buf, sizeof(buf)/sizeof(TCHAR));
+ if (ret)
+ {
+ exit(-1);
+ }
+ for (int i=_tcslen(buf); i>0; --i)
+ {
+ if (buf[i] == '\\')
+ {
+ buf[i+1] = '\0';
+ break;
+ }
+ }
+
+ exePath = buf;
+ }
+
+ iniFileName.set(exePath.cstr());
+ iniFileName.append("\\peercast.ini");
+
+ _chdir(exePath);
+
+ peercastInst = new MyPeercastInst();
+ peercastApp = new MyPeercastApp();
+
+ peercastInst->init();
+
+ LOG_DEBUG("Set OS Type: %s",winDistinctionNT?"WinNT":"Win9x");
+
+ if (peercastApp->clearTemp()) //JP-EX
+ {
+ DeleteFile("play.pls");
+ hFind = FindFirstFile("*.asx",&fd);
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ DeleteFile((char *)&fd.cFileName);
+ }
+ while (FindNextFile(hFind,&fd));
+
+ FindClose(hFind);
+ }
+ }
+
+ peercastInst->saveSettings();
+ peercastInst->quit();
+}
// --------------------------------------------------
int WinMainDummy(HINSTANCE hInstance,
_EXCEPTION_POINTERS *lpExcept;
__try
{
- WinMainDummy(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
-
+#if 0
+ // switch to service
+ if (lstrlen(lpCmdLine) && strstr(lpCmdLine, "-D") != NULL)
+ {
+ SERVICE_TABLE_ENTRY svctbl[] = {
+ {"PeerCast", (LPSERVICE_MAIN_FUNCTION)ServiceMain},
+ {NULL, NULL}
+ };
+
+ if (!StartServiceCtrlDispatcher(svctbl))
+ {
+ //SvcReportEvent(TEXT("StartServiceCtrlDispatcher"));
+ }
+ } else
+#endif
+ WinMainDummy(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
} __except(lpExcept = GetExceptionInformation(), EXCEPTION_EXECUTE_HANDLER)
{
DWORD nParams;
char str[128],fname[256],idStr[128];
- sprintf(str,"http://localhost:%d",servMgr->serverHost.port);
+ sprintf(str,"http://127.0.0.1:%d",servMgr->serverHost.port);
info.id.toStr(idStr);
PlayList::TYPE type;
#if 1 /* for VP extend version */
//#define VERSION_EX 1
static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
-static const int PCP_CLIENT_VERSION_EX_NUMBER = 32;
-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0032)";
-static const char *PCX_VERSTRING_EX = "v0.1218(IM0032)";
+static const int PCP_CLIENT_VERSION_EX_NUMBER = 33;
+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0033)";
+static const char *PCX_VERSTRING_EX = "v0.1218(IM0033)";
#endif
// ------------------------------------------------
void WSys::callLocalURL(const char *str,int port)
{
char cmd[512];
- sprintf(cmd,"http://localhost:%d/%s",port,str);
+ sprintf(cmd,"http://127.0.0.1:%d/%s",port,str);
ShellExecute(mainWindow, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
}
va_end(ap);
}
+// --------------------------------------------------
+void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
+{
+ //hInst = hInstance;
+
+ version_ex = 1; // PP\94Å\8ag\92£\8b@\94\\82ð\96³\8cø\82É\81©\91å\89R\81B\83o\81[\83W\83\87\83\93\95\\8bL\82ðEX\82É
+
+ //iniFileName.set(".\\peercast.ini");
+
+ WIN32_FIND_DATA fd; //JP-EX
+ HANDLE hFind; //JP-EX
+
+ OSVERSIONINFO osInfo; //JP-EX
+ osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); //JP-EX
+ GetVersionEx(&osInfo);
+ if (osInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ winDistinctionNT = true;
+ else
+ winDistinctionNT = false;
+
+ // off by default now
+ showGUI = false;
+
+ // get current path
+ {
+ TCHAR buf[1024];
+ DWORD ret;
+
+ ret = GetModuleFileName(NULL, buf, sizeof(buf)/sizeof(TCHAR));
+ if (ret)
+ {
+ exit(-1);
+ }
+ for (int i=_tcslen(buf); i>0; --i)
+ {
+ if (buf[i] == '\\')
+ {
+ buf[i+1] = '\0';
+ break;
+ }
+ }
+
+ exePath = buf;
+ }
+
+ iniFileName.set(exePath.cstr());
+ iniFileName.append("\\peercast.ini");
+
+ _chdir(exePath);
+
+ peercastInst = new MyPeercastInst();
+ peercastApp = new MyPeercastApp();
+
+ peercastInst->init();
+
+ LOG_DEBUG("Set OS Type: %s",winDistinctionNT?"WinNT":"Win9x");
+
+ if (peercastApp->clearTemp()) //JP-EX
+ {
+ DeleteFile("play.pls");
+ hFind = FindFirstFile("*.asx",&fd);
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ DeleteFile((char *)&fd.cFileName);
+ }
+ while (FindNextFile(hFind,&fd));
+
+ FindClose(hFind);
+ }
+ }
+
+ peercastInst->saveSettings();
+ peercastInst->quit();
+}
// --------------------------------------------------
int WinMainDummy(HINSTANCE hInstance,
_EXCEPTION_POINTERS *lpExcept;
__try
{
- WinMainDummy(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
-
+#if 0
+ // switch to service
+ if (lstrlen(lpCmdLine) && strstr(lpCmdLine, "-D") != NULL)
+ {
+ SERVICE_TABLE_ENTRY svctbl[] = {
+ {"PeerCast", (LPSERVICE_MAIN_FUNCTION)ServiceMain},
+ {NULL, NULL}
+ };
+
+ if (!StartServiceCtrlDispatcher(svctbl))
+ {
+ //SvcReportEvent(TEXT("StartServiceCtrlDispatcher"));
+ }
+ } else
+#endif
+ WinMainDummy(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
} __except(lpExcept = GetExceptionInformation(), EXCEPTION_EXECUTE_HANDLER)
{
DWORD nParams;