Created
December 10, 2017 06:26
-
-
Save n13i/29c7f8a55a887f247d7ff0960b91c1cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- BonDriver.cpp Thu Aug 22 19:52:37 2013 | |
+++ BonDriver.cpp Thu Aug 22 19:55:00 2013 | |
@@ -9,10 +9,21 @@ | |
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) | |
{ | |
+ INT size = 0; | |
+ LPTSTR p = NULL; | |
+ | |
switch(ul_reason_for_call){ | |
case DLL_PROCESS_ATTACH: | |
// モジュールハンドル保存 | |
CBonTuner::m_hModule = hModule; | |
+ | |
+ size = GetModuleFileName((HMODULE)hModule, CBonTuner::m_szIniFileName, _MAX_PATH); | |
+ p = CBonTuner::m_szIniFileName + size; | |
+ while(*p != '.') { p--; } | |
+ *(p+1) ='i'; | |
+ *(p+2) ='n'; | |
+ *(p+3) ='i'; | |
+ *(p+4) ='\0'; | |
break; | |
case DLL_PROCESS_DETACH: | |
--- BonTuner.cpp Thu Aug 22 19:52:37 2013 | |
+++ BonTuner.cpp Thu Aug 22 19:56:10 2013 | |
@@ -4,6 +4,7 @@ | |
#include "stdafx.h" | |
#include <InitGuid.h> | |
+#include <tchar.h> | |
#include "BonTuner.h" | |
#pragma comment(lib, "ws2_32.lib") | |
@@ -58,6 +59,7 @@ | |
// 静的メンバ初期化 | |
CBonTuner * CBonTuner::m_pThis = NULL; | |
HINSTANCE CBonTuner::m_hModule = NULL; | |
+TCHAR CBonTuner::m_szIniFileName[_MAX_PATH] = _T(""); | |
CBonTuner::CBonTuner() | |
: m_bTunerOpen(false) | |
@@ -313,11 +315,11 @@ | |
LPCTSTR CBonTuner::EnumChannelName(const DWORD dwSpace, const DWORD dwChannel) | |
{ | |
// 使用可能なチャンネルを返す | |
- if(dwSpace > 0 || (dwChannel >= GetPrivateProfileInt(L"BonDriver_HTTP", L"CH_NUM", 0, L"./BonDriver_HTTP.ini" )))return NULL; | |
+ if(dwSpace > 0 || (dwChannel >= GetPrivateProfileInt(L"BonDriver_HTTP", L"CH_NUM", 0, m_szIniFileName))) return NULL; | |
static TCHAR buf[128]; | |
TCHAR istr[128]; | |
wsprintf(istr,L"NAME_%02d",dwChannel); | |
- GetPrivateProfileString(L"BonDriver_HTTP", istr, L"default", buf, sizeof(buf), L"./BonDriver_HTTP.ini" ); | |
+ GetPrivateProfileString(L"BonDriver_HTTP", istr, L"default", buf, sizeof(buf), m_szIniFileName); | |
return buf; | |
} | |
@@ -519,7 +521,7 @@ | |
const BOOL CBonTuner::SetChannel(const DWORD dwSpace, const DWORD dwChannel) | |
{ | |
// 有効なチャンネルか | |
- if(dwSpace > 0 || (dwChannel >= GetPrivateProfileInt(L"BonDriver_HTTP", L"CH_NUM", 0, L"./BonDriver_HTTP.ini" ))) | |
+ if(dwSpace > 0 || (dwChannel >= GetPrivateProfileInt(L"BonDriver_HTTP", L"CH_NUM", 0, m_szIniFileName))) | |
return FALSE; | |
// 一旦クローズ | |
@@ -557,11 +559,11 @@ | |
WCHAR whost[128],temp[128],wpath[128],istr[128]; | |
wsprintf(istr,L"HOST_%02d",dwChannel); | |
- GetPrivateProfileString(L"BonDriver_HTTP", istr, L"default", whost, sizeof(whost), L"./BonDriver_HTTP.ini" ); | |
+ GetPrivateProfileString(L"BonDriver_HTTP", istr, L"default", whost, sizeof(whost), m_szIniFileName); | |
wsprintf(istr,L"PORT_%02d",dwChannel); | |
- port_num = GetPrivateProfileInt(L"BonDriver_HTTP", istr, 0, L"./BonDriver_HTTP.ini"); | |
+ port_num = GetPrivateProfileInt(L"BonDriver_HTTP", istr, 0, m_szIniFileName); | |
wsprintf(istr,L"PATH_%02d",dwChannel); | |
- GetPrivateProfileString(L"BonDriver_HTTP", istr, L"default", temp, sizeof(wpath), L"./BonDriver_HTTP.ini" ); | |
+ GetPrivateProfileString(L"BonDriver_HTTP", istr, L"default", temp, sizeof(wpath), m_szIniFileName); | |
wsprintf(wpath,L"GET %s HTTP/1.0\r\n\r\n",temp); | |
size_t i; | |
--- BonTuner.h Thu Aug 22 19:52:37 2013 | |
+++ BonTuner.h Sat Aug 17 01:27:21 2013 | |
@@ -57,6 +57,7 @@ | |
static HINSTANCE m_hModule; | |
static char * m_cList[7]; | |
+ static TCHAR m_szIniFileName[_MAX_PATH]; | |
protected: | |
// I/Oリクエストキューデータ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment