diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-19 08:02:41 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-19 08:02:41 +0000 |
commit | 08dc125be616458112368e7154b29d5d23f1126e (patch) | |
tree | 1c27ef9b8525f45913c19bb6f4c18a31b6593749 /plugins/StatusPlugins | |
parent | a63798c1b60eeb77352323ad4545630cdc5458f2 (diff) |
Unicode in status message plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@1033 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp | 6 | ||||
-rw-r--r-- | plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 32 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/options.cpp | 12 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/profiles.cpp | 12 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.cpp | 6 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.h | 4 | ||||
-rw-r--r-- | plugins/StatusPlugins/commonstatus.cpp | 119 | ||||
-rw-r--r-- | plugins/StatusPlugins/confirmdialog.cpp | 10 |
8 files changed, 30 insertions, 171 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index c969b5c98a..d4527e8091 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -275,8 +275,8 @@ static int changeState(TAAAProtoSetting& setting, STATES newState) if (DBGetContactSettingByte(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_MSGCUSTOM), FALSE)) {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) {
- setting.szMsg = _strdup(dbv.pszVal);
+ if (!DBGetContactSettingTString(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) {
+ setting.szMsg = _tcsdup(dbv.ptszVal);
DBFreeVariant(&dbv);
} }
}
@@ -409,7 +409,7 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD int i;
for ( i=0; i < ps.getCount(); i++ ) {
if ( ps[i].szMsg )
- ps[i].szMsg = _strdup( ps[i].szMsg );
+ ps[i].szMsg = _tcsdup( ps[i].szMsg );
if (ps[i].status == ID_STATUS_DISABLED)
ps[i].szName = "";
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 929a9aa1df..b451325c19 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -71,7 +71,7 @@ static int StartTimer(int timer, int timeout, BOOL restart); static int StopTimer(int timer);
int LoadMainOptions();
static void GetCurrentConnectionSettings();
-static int AssignStatus(TConnectionSettings* connSetting, int status, int lastStatus, char *szMsg);
+static int AssignStatus(TConnectionSettings* connSetting, int status, int lastStatus, TCHAR *szMsg);
static int ProcessProtoAck(WPARAM wParam,LPARAM lParam);
static VOID CALLBACK CheckConnectingTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime);
static VOID CALLBACK CheckAckStatusTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime);
@@ -215,30 +215,6 @@ static PROTOCOLSETTINGEX** GetCurrentProtoSettingsCopy() ps[i]->szMsg = NULL;
ps[i]->szName = cs.szName;
ps[i]->tszAccName = cs.tszAccName;
- if ( (ServiceExists(MS_NAS_GETSTATE)) && (CallProtoService(ps[i]->szName, PS_GETSTATUS, 0, 0) == ID_STATUS_OFFLINE) && (ps[i]->status != ID_STATUS_OFFLINE)) {
- NAS_PROTOINFO npi;
-
- ZeroMemory(&npi, sizeof(NAS_PROTOINFO));
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.status = 0;
- npi.szProto = ps[i]->szName;
- if (!CallService(MS_NAS_GETSTATEA, (WPARAM)&npi, (LPARAM)1)) {
- if (npi.szMsg != NULL) {
- ps[i]->szMsg = _strdup(npi.szMsg);
- log_infoA("KeepStatus: Status message for %s retrieved from NAS", ps[i]->szName);
- }
- else {
- npi.status = 0;
- npi.szProto = NULL;
- if (!CallService(MS_NAS_GETSTATEA, (WPARAM)&npi, (LPARAM)1)) {
- if (npi.szMsg != NULL) {
- ps[i]->szMsg = _strdup(npi.szMsg);
- log_infoA("KeepStatus: Status message for %s retrieved from NAS (global)", ps[i]->szName);
- }
- }
- }
- }
- }
}
LeaveCriticalSection(&GenStatusCS);
@@ -255,7 +231,7 @@ static void FreeProtoSettings(PROTOCOLSETTINGEX** ps) free(ps);
}
-static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, char *szMsg)
+static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCHAR *szMsg)
{
if ( status < MIN_STATUS || status > MAX_STATUS )
return -1;
@@ -274,11 +250,11 @@ static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, cha log_infoA("KeepStatus: assigning status %d to %s", cs->status, cs->szName);
- if ( szMsg != NULL && szMsg != cs->szMsg ) {
+ if ( szMsg != NULL && _tcscmp(szMsg, cs->szMsg)) {
if ( cs->szMsg != NULL )
free(cs->szMsg);
- cs->szMsg = _strdup(szMsg);
+ cs->szMsg = _tcsdup(szMsg);
}
else if (szMsg != cs->szMsg) {
if (cs->szMsg != NULL)
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 107cf06e99..410412072c 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -442,7 +442,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa GetProfile( defProfile, *ps );
for ( int i=0; i < ps->getCount(); i++ )
if ( (*ps)[i].szMsg != NULL )
- (*ps)[i].szMsg = _strdup( (*ps)[i].szMsg );
+ (*ps)[i].szMsg = _tcsdup( (*ps)[i].szMsg );
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CMDLOPTIONS), hwndDlg, CmdlOptionsDlgProc, (LPARAM)ps);
}
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP else {
for (int j=0; j < ar.getCount(); j++)
if ( ar[j].szMsg != NULL)
- ar[j].szMsg = _strdup( ar[j].szMsg );
+ ar[j].szMsg = _tcsdup( ar[j].szMsg );
ppo->szName = db_get_sa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME));
if (ppo->szName == NULL) {
@@ -662,7 +662,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP CheckRadioButton(hwndDlg, IDC_MIRANDAMSG, IDC_CUSTOMMSG, ps->szMsg!=NULL?IDC_CUSTOMMSG:IDC_MIRANDAMSG);
if (ps->szMsg != NULL)
- SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, ps->szMsg);
+ SetDlgItemText(hwndDlg, IDC_STATUSMSG, ps->szMsg);
bStatusMsg = ( (((CallProtoService(ps->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND&~PF1_INDIVMODEMSG)) &&
(CallProtoService(ps->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(ps->status))) || (ps->status == ID_STATUS_CURRENT) || (ps->status == ID_STATUS_LAST));
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP ps->szMsg = NULL;
if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOMMSG)) {
len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
- ps->szMsg = (char *)malloc(len+1);
+ ps->szMsg = (TCHAR*)calloc(sizeof(TCHAR), len+1);
memset(ps->szMsg, '\0', len+1);
SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXT, (WPARAM)len+1, (LPARAM)ps->szMsg);
}
@@ -774,7 +774,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP ps->szMsg = NULL;
}
int len = SendDlgItemMessageA(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
- ps->szMsg = (char *)malloc(len+1);
+ ps->szMsg = (TCHAR*)calloc(sizeof(TCHAR), len+1);
memset(ps->szMsg, '\0', len+1);
SendDlgItemMessageA(hwndDlg, IDC_STATUSMSG, WM_GETTEXT, (WPARAM)len+1, (LPARAM)ps->szMsg);
}
@@ -851,7 +851,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP for ( j=0; j < ar.getCount(); j++ ) {
if ( ar[j].szMsg != NULL ) {
mir_snprintf(setting, sizeof(setting), "%s_%s", ar[j].szName, SETTING_PROFILE_STSMSG);
- db_set_s(NULL, MODULENAME, OptName(i, setting), ar[j].szMsg);
+ db_set_ts(NULL, MODULENAME, OptName(i, setting), ar[j].szMsg);
}
db_set_w(NULL, MODULENAME, OptName(i, ar[j].szName), ar[j].status);
}
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index dbf7ebec82..3cb20918f8 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -183,7 +183,7 @@ INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam) return count;
}
-char *GetStatusMessage(int profile, char *szProto)
+TCHAR *GetStatusMessage(int profile, char *szProto)
{
char dbSetting[80];
DBVARIANT dbv;
@@ -191,10 +191,10 @@ char *GetStatusMessage(int profile, char *szProto) for ( int i=0; i < pceCount; i++ ) {
if ( (pce[i].profile == profile) && (!strcmp(pce[i].szProto, szProto))) {
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!DBGetContactSetting(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
- pce[i].msg = ( char* )realloc(pce[i].msg, strlen(dbv.pszVal)+1);
+ if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
+ pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(_tcslen(dbv.ptszVal)+1));
if (pce[i].msg != NULL) {
- strcpy(pce[i].msg, dbv.pszVal);
+ _tcscpy(pce[i].msg, dbv.ptszVal);
}
DBFreeVariant(&dbv);
}
@@ -215,8 +215,8 @@ char *GetStatusMessage(int profile, char *szProto) pce[pceCount].szProto = _strdup(szProto);
pce[pceCount].msg = NULL;
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!DBGetContactSetting(NULL, MODULENAME, dbSetting, &dbv)) {
- pce[pceCount].msg = _strdup(dbv.pszVal);
+ if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
+ pce[pceCount].msg = _tcsdup(dbv.ptszVal);
DBFreeVariant(&dbv);
}
pceCount += 1;
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index 7028868272..e1445a7704 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -64,7 +64,7 @@ TSSSetting::TSSSetting( int profile, PROTOACCOUNT* pa ) szMsg = GetStatusMessage(profile, szName);
if ( szMsg )
- szMsg = _strdup( szMsg );
+ szMsg = _tcsdup( szMsg );
}
TSSSetting::~TSSSetting()
@@ -178,8 +178,8 @@ static void SetLastStatusMessages(TSettingsList& ps) _snprintf(dbSetting, sizeof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
DBVARIANT dbv;
- if ( ps[i].szMsg == NULL && !DBGetContactSetting(NULL, MODULENAME, dbSetting, &dbv)) {
- ps[i].szMsg = _strdup(dbv.pszVal); // remember this won't be freed
+ if ( ps[i].szMsg == NULL && !DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
+ ps[i].szMsg = _tcsdup(dbv.ptszVal); // remember this won't be freed
DBFreeVariant(&dbv);
} } }
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index d6248ba4b2..640638f788 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -45,7 +45,7 @@ struct PROFILECE {
int profile;
char *szProto;
- char *msg;
+ TCHAR *msg;
};
struct PROFILEOPTIONS
@@ -152,7 +152,7 @@ TSettingsList* GetCurrentProtoSettings(); // profile
int GetProfile(int profileID, TSettingsList& arSettings );
-char *GetStatusMessage(int profile, char *szProto);
+TCHAR *GetStatusMessage(int profile, char *szProto);
INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam);
INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index c2cc820e9b..cb5f9ea9c5 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -122,7 +122,7 @@ TCHAR *GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int newstatus) {
if (ps->szMsg != NULL) {// custom message set
log_infoA("CommonStatus: Status message set by calling plugin");
- return mir_a2t( ps->szMsg );
+ return mir_tstrdup( ps->szMsg );
}
if ( ServiceExists( MS_AWAYMSG_GETSTATUSMSGT )) {
@@ -196,119 +196,6 @@ static int equalsGlobalStatus(PROTOCOLSETTINGEX **ps) { return gstatus;
}
-static int nasSetStatus(PROTOCOLSETTINGEX **protoSettings, int newstatus)
-{
- NAS_PROTOINFO npi;
- char **nasProtoMessages, *nasGlobalMsg;
- int i, j, msgCount, maxMsgCount;
-
- if (!ServiceExists(MS_NAS_SETSTATE))
- return -1;
-
- nasGlobalMsg = NULL;
- msgCount = maxMsgCount = 0;
- if (newstatus == 0) {
- /*
- The global status will not be changed. Still, we'd like to set the global status message for NAS.
- This should only be done if all protocols will change in this call. Otherwise, the chance exists
- that an already set status message will be overwritten. The global status message will be set for
- the status message which is to be set for most of the protocols. Protocols are only considered
- which have szMsg==NULL. After the global status message is set, the protocols for which another
- message and/or status have to be set will be overwritten.
- */
- ZeroMemory(&npi, sizeof(NAS_PROTOINFO));
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.status = 0;
- npi.szProto = NULL;
- CallService(MS_NAS_GETSTATEA, (WPARAM)&npi, (LPARAM)1);
- nasProtoMessages = ( char** )calloc(protoList->getCount(),sizeof(char *));
- if (nasProtoMessages == NULL) {
- return -1;
- }
- // fill the array of proto message for NAS, this will be used anyway
- for (i=0;i<protoList->getCount();i++) {
- if ( (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protoSettings[i]->szName)) || (protoSettings[i]->szMsg != NULL)) {
- continue;
- }
- ZeroMemory(&npi, sizeof(NAS_PROTOINFO));
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.status = GetActualStatus(protoSettings[i]);
- npi.szProto = protoSettings[i]->szName;
- if (CallService(MS_NAS_GETSTATEA, (WPARAM)&npi, (LPARAM)1) == 0) {
- nasProtoMessages[i] = npi.szMsg;
- }
- }
- // if not all proto's are to be set here, we don't set the global status message
- for (i=0;i<protoList->getCount();i++) {
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protoSettings[i]->szName)) {
- break;
- }
- }
- if (i == protoList->getCount()) {
- for (i=0;i<protoList->getCount();i++) {
- msgCount = 0;
- for (j=i;j<protoList->getCount();j++) {
- if ( (nasProtoMessages[i] != NULL) && (nasProtoMessages[j] != NULL) && (!strcmp(nasProtoMessages[i], nasProtoMessages[j]))) {
- msgCount += 1;
- //log_infoA("Adding %s (%u) to %s (%u)", protoSettings[j]->szName, protoSettings[j]->status, protoSettings[i]->szName, protoSettings[i]->status);
- }
- }
- if ( (msgCount > maxMsgCount) && ((protoList->getCount() == 1) || (msgCount > 1))) {
- maxMsgCount = msgCount;
- nasGlobalMsg = _strdup(nasProtoMessages[i]);
- }
- }
- }
- if (nasGlobalMsg != NULL) {
- // set global message
- ZeroMemory(&npi, sizeof(NAS_PROTOINFO));
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.status = 0; // status is not important for global message
- npi.szMsg = mir_strdup(nasGlobalMsg);
- npi.Flags |= PIF_NO_CLIST_SETSTATUSMODE;
- log_infoA("CommonStatus sets global status message for NAS which is to be changed for %d protocols", maxMsgCount);
- CallService(MS_NAS_SETSTATEA, (WPARAM)&npi, (LPARAM)1);
- }
- for (i=0;i<protoList->getCount();i++) {
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protoSettings[i]->szName))
- continue;
-
- ZeroMemory(&npi, sizeof(NAS_PROTOINFO));
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.status = GetActualStatus(protoSettings[i]);
- npi.szProto = protoSettings[i]->szName;
- if (protoSettings[i]->szMsg != NULL) {
- npi.szMsg = mir_strdup(protoSettings[i]->szMsg);
- log_infoA("CommonStatus will set status %u for %s and message specified by plugin using NAS (%x)", npi.status, npi.szProto, npi.szMsg);
- }
- else if ( (nasProtoMessages[i] != NULL) && (nasGlobalMsg != NULL) && (!strcmp(nasProtoMessages[i], nasGlobalMsg))) {
- npi.szMsg = NULL;
- log_infoA("CommonStatus will set status %u for %s and global message using NAS", npi.status, npi.szProto);
- }
- else {
- npi.szMsg = nasProtoMessages[i];
- log_infoA("CommonStatus will set status %u for %s and message from NAS using NAS", npi.status, npi.szProto);
- }
- CallService(MS_NAS_SETSTATEA, (WPARAM)&npi, (LPARAM)1);
- }
- if (nasGlobalMsg != NULL) {
- free(nasGlobalMsg);
- }
- free(nasProtoMessages);
- }
- else {
- ZeroMemory(&npi, sizeof(NAS_PROTOINFO));
- npi.cbSize = sizeof(NAS_PROTOINFO);
- npi.szProto = NULL; // global
- npi.szMsg = NULL; // global
- npi.status = newstatus;
- log_debugA("CommonStatus sets global status %u using NAS", newstatus);
- CallService(MS_NAS_SETSTATEA, (WPARAM)&npi, (LPARAM)1);
- }
-
- return 0;
-}
-
static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus)
{
TCHAR* tszMsg = GetDefaultStatusMessage( ps, newstatus );
@@ -412,10 +299,6 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam) CallProtoService(szProto, PS_SETSTATUS, (WPARAM)newstatus, 0);
} }
- // and finally set a status
- if ( !nasSetStatus( protoSettings, globStatus ))
- return 0;
-
if ( globStatus != 0 ) {
if ( !ServiceExists( MS_CLIST_SETSTATUSMODE )) {
log_debugA("CommonStatus: MS_CLIST_SETSTATUSMODE not available!");
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index 2d93e181fc..da3f428062 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -33,7 +33,7 @@ struct TConfirmSetting : public PROTOCOLSETTINGEX {
memcpy( this, &x, sizeof(PROTOCOLSETTINGEX));
if ( szMsg )
- szMsg = _strdup( szMsg );
+ szMsg = _tcsdup( szMsg );
}
~TConfirmSetting()
@@ -64,7 +64,7 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam mir_free(smsg);
}
}
- else SetDlgItemTextA(hwndDlg, IDC_STSMSG, protoSetting->szMsg);
+ else SetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg);
{
TCHAR desc[ 512 ];
@@ -82,9 +82,9 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam {
int len = SendMessage(GetDlgItem(hwndDlg, IDC_STSMSG), WM_GETTEXTLENGTH, 0, 0);
if (len > 0) {
- protoSetting->szMsg = ( char* )realloc(protoSetting->szMsg, len+1);
+ protoSetting->szMsg = ( TCHAR* )realloc(protoSetting->szMsg, sizeof(TCHAR)*(len+1));
if (protoSetting->szMsg != NULL)
- GetDlgItemTextA(hwndDlg, IDC_STSMSG, protoSetting->szMsg, len+1);
+ GetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg, len+1);
}
SendMessage(GetParent(hwndDlg), UM_STSMSGDLGCLOSED, (WPARAM)TRUE, 0);
EndDialog(hwndDlg, IDC_OK);
@@ -247,7 +247,7 @@ static BOOL CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l CallService(MS_SS_GETPROFILE, (WPARAM)profile, (LPARAM)&confirmSettings);
for ( i=0; i < confirmSettings.getCount(); i++ )
if (confirmSettings[i].szMsg != NULL) // we free this later, copy to our memory space
- confirmSettings[i].szMsg = _strdup(confirmSettings[i].szMsg);
+ confirmSettings[i].szMsg = _tcsdup(confirmSettings[i].szMsg);
SetStatusList(hwndDlg);
}
|