Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

hsz.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

HSZ DdeCreateStringHandleA (DWORD idInst, LPCSTR psz, int iCodePage)
HSZ DdeCreateStringHandleW (DWORD idInst, LPCWSTR psz, int iCodePage)
HSZ InternalDdeCreateStringHandle (DWORD idInst, PVOID psz, int iCodePage)
DWORD DdeQueryStringA (DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, INT iCodePage)
DWORD DdeQueryStringW (DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, INT iCodePage)
DWORD InternalDdeQueryString (DWORD idInst, HSZ hsz, PVOID psz, DWORD cbMax, INT iCodePage)
BOOL DdeFreeStringHandle (DWORD idInst, HSZ hsz)
BOOL DdeKeepStringHandle (DWORD idInst, HSZ hsz)
int DdeCmpStringHandles (HSZ hsz1, HSZ hsz2)
DWORD ValidateHSZ (HSZ hsz)
LATOM MakeInstSpecificAtom (LATOM la, HWND hwnd)
HWND ParseInstSpecificAtom (LATOM la, LATOM *plaNormal)
GATOM LocalToGlobalAtom (LATOM la)
LATOM GlobalToLocalAtom (GATOM ga)
GATOM IncGlobalAtomCount (GATOM ga)
LATOM IncLocalAtomCount (LATOM la)


Function Documentation

int DdeCmpStringHandles HSZ  hsz1,
HSZ  hsz2
 

Definition at line 317 of file hsz.c.

00320 { 00321 if (hsz2 > hsz1) { 00322 return (-1); 00323 } else if (hsz2 < hsz1) { 00324 return (1); 00325 } else { 00326 return (0); 00327 } 00328 }

HSZ DdeCreateStringHandleA DWORD  idInst,
LPCSTR  psz,
int  iCodePage
 

Definition at line 24 of file hsz.c.

References InternalDdeCreateStringHandle().

00028 { 00029 if (iCodePage == 0) { 00030 iCodePage = CP_WINANSI; 00031 } 00032 return (InternalDdeCreateStringHandle(idInst, (PVOID)psz, iCodePage)); 00033 }

HSZ DdeCreateStringHandleW DWORD  idInst,
LPCWSTR  psz,
int  iCodePage
 

Definition at line 36 of file hsz.c.

References InternalDdeCreateStringHandle().

00040 { 00041 if (iCodePage == 0) { 00042 iCodePage = CP_WINUNICODE; 00043 } 00044 return (InternalDdeCreateStringHandle(idInst, (PVOID)psz, iCodePage)); 00045 }

BOOL DdeFreeStringHandle DWORD  idInst,
HSZ  hsz
 

Definition at line 227 of file hsz.c.

References BestSetLastDDEMLError(), BOOL, EnterDDECrit, FALSE, HSZT_INVALID, LATOM_FROM_HSZ, LeaveDDECrit, MONHSZ, NULL, SetLastDDEMLError(), TRUE, ValidateHSZ(), and ValidateInstance().

00230 { 00231 PCL_INSTANCE_INFO pcii; 00232 BOOL fRet = FALSE; 00233 00234 EnterDDECrit; 00235 00236 pcii = ValidateInstance((HANDLE)LongToHandle( idInst )); 00237 if (pcii == NULL) { 00238 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00239 goto Exit; 00240 } 00241 00242 if (ValidateHSZ(hsz) == HSZT_INVALID) { 00243 SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER); 00244 goto Exit; 00245 } 00246 00247 MONHSZ(pcii, hsz, MH_DELETE); 00248 fRet = TRUE; 00249 if (LATOM_FROM_HSZ(hsz) != 0) { 00250 if (DeleteAtom(LATOM_FROM_HSZ(hsz))) { 00251 SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER); 00252 fRet = FALSE; 00253 } 00254 } 00255 00256 Exit: 00257 LeaveDDECrit; 00258 return (fRet); 00259 }

BOOL DdeKeepStringHandle DWORD  idInst,
HSZ  hsz
 

Definition at line 272 of file hsz.c.

References BestSetLastDDEMLError(), BOOL, EnterDDECrit, FALSE, HSZT_INVALID, IncLocalAtomCount(), LATOM_FROM_HSZ, LeaveDDECrit, MONHSZ, NULL, SetLastDDEMLError(), TRUE, ValidateHSZ(), and ValidateInstance().

00275 { 00276 PCL_INSTANCE_INFO pcii; 00277 BOOL fRet = FALSE; 00278 00279 EnterDDECrit; 00280 00281 pcii = ValidateInstance((HANDLE)LongToHandle( idInst )); 00282 if (pcii == NULL) { 00283 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00284 goto Exit; 00285 } 00286 00287 if (ValidateHSZ(hsz) == HSZT_INVALID) { 00288 SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER); 00289 goto Exit; 00290 } 00291 00292 if (LATOM_FROM_HSZ(hsz) == 0) { 00293 fRet = TRUE; 00294 goto Exit; 00295 } 00296 MONHSZ(pcii, hsz, MH_KEEP); 00297 fRet = IncLocalAtomCount(LATOM_FROM_HSZ(hsz)) ? TRUE : FALSE; 00298 00299 Exit: 00300 LeaveDDECrit; 00301 return (fRet); 00302 }

DWORD DdeQueryStringA DWORD  idInst,
HSZ  hsz,
LPSTR  psz,
DWORD  cchMax,
INT  iCodePage
 

Definition at line 113 of file hsz.c.

References DWORD, and InternalDdeQueryString().

00119 { 00120 if (iCodePage == 0) { 00121 iCodePage = CP_WINANSI; 00122 } 00123 return (InternalDdeQueryString(idInst, hsz, psz, cchMax, iCodePage)); 00124 }

DWORD DdeQueryStringW DWORD  idInst,
HSZ  hsz,
LPWSTR  psz,
DWORD  cchMax,
INT  iCodePage
 

Definition at line 127 of file hsz.c.

References DWORD, and InternalDdeQueryString().

00133 { 00134 if (iCodePage == 0) { 00135 iCodePage = CP_WINUNICODE; 00136 } 00137 return (InternalDdeQueryString(idInst, hsz, psz, cchMax * sizeof(WCHAR), iCodePage)); 00138 }

LATOM GlobalToLocalAtom GATOM  ga  ) 
 

Definition at line 464 of file hsz.c.

References LATOM.

Referenced by _ClientEventCallback(), AddLink(), ClRespUnadviseAck(), ClSpontAdviseData(), DDEMLClientWndProc(), DdeQueryConvInfo(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), SvRespAdviseDataAck(), SvSpontAdvise(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), SvStartAdviseUpdate(), and TransactionComplete().

00466 { 00467 WCHAR sz[256]; 00468 00469 if (ga == 0) { 00470 return (0); 00471 } 00472 if (GlobalGetAtomName((ATOM)ga, sz, 256) == 0) { 00473 RIPMSG0(RIP_WARNING, "GlobalToLocalAtom out of memory"); 00474 return (0); 00475 } 00476 return ((LATOM)AddAtom(sz)); 00477 }

GATOM IncGlobalAtomCount GATOM  ga  ) 
 

Definition at line 490 of file hsz.c.

References GATOM.

Referenced by AddLink(), ClStartAdvise(), ClStartPoke(), ClStartRequest(), ClStartUnadvise(), MonitorLink(), SendRegisterMessageToClass(), and SvStartAdviseUpdate().

00492 { 00493 WCHAR sz[256]; 00494 00495 if (ga == 0) { 00496 return (0); 00497 } 00498 if (GlobalGetAtomName(ga, sz, 256) == 0) { 00499 RIPMSG0(RIP_WARNING, "IncGlobalAtomCount out of memory"); 00500 return (0); 00501 } 00502 return ((GATOM)GlobalAddAtom(sz)); 00503 }

LATOM IncLocalAtomCount LATOM  la  ) 
 

Definition at line 516 of file hsz.c.

References LATOM.

Referenced by AddLink(), ConnectConv(), DdeKeepStringHandle(), DdeNameService(), InitiateEnumerationProc(), and ProcessDDEMLInitiate().

00518 { 00519 WCHAR sz[256]; 00520 00521 if (la == 0) { 00522 return (0); 00523 } 00524 if (GetAtomName(la, sz, 256) == 0) { 00525 RIPMSG0(RIP_WARNING, "IncLocalAtomCount out of memory"); 00526 return (0); 00527 } 00528 return ((LATOM)AddAtom(sz)); 00529 }

HSZ InternalDdeCreateStringHandle DWORD  idInst,
PVOID  psz,
int  iCodePage
 

Definition at line 49 of file hsz.c.

References BestSetLastDDEMLError(), EnterDDECrit, L, LeaveDDECrit, MONHSZ, NORMAL_HSZ_FROM_LATOM, NULL, UINT, and ValidateInstance().

Referenced by DdeCreateStringHandleA(), and DdeCreateStringHandleW().

00053 { 00054 PCL_INSTANCE_INFO pcii; 00055 HSZ hszRet = 0; 00056 int cb; 00057 WCHAR szw[256]; 00058 00059 EnterDDECrit; 00060 00061 pcii = ValidateInstance((HANDLE)LongToHandle( idInst )); 00062 if (pcii == NULL) { 00063 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00064 goto Exit; 00065 } 00066 00067 switch (iCodePage) { 00068 case CP_WINANSI: 00069 if (*(LPSTR)psz == '\0') { 00070 goto Exit; 00071 } 00072 hszRet = NORMAL_HSZ_FROM_LATOM(AddAtomA((LPSTR)psz)); 00073 break; 00074 00075 default: 00076 00077 /* 00078 * Convert psz to unicode and fall through. 00079 */ 00080 cb = sizeof(szw) / sizeof(WCHAR); 00081 #ifdef LATER 00082 MultiByteToWideChar((UINT)iCodePage, MB_PRECOMPOSED, 00083 (LPSTR)psz, -1, szw, cb); 00084 #endif 00085 psz = &szw[0]; 00086 00087 00088 case CP_WINUNICODE: 00089 if (*(LPWSTR)psz == L'\0') { 00090 goto Exit; 00091 } 00092 hszRet = NORMAL_HSZ_FROM_LATOM(AddAtomW((LPWSTR)psz)); 00093 break; 00094 } 00095 MONHSZ(pcii, hszRet, MH_CREATE); 00096 00097 Exit: 00098 LeaveDDECrit; 00099 return (hszRet); 00100 }

DWORD InternalDdeQueryString DWORD  idInst,
HSZ  hsz,
PVOID  psz,
DWORD  cbMax,
INT  iCodePage
 

Definition at line 141 of file hsz.c.

References BestSetLastDDEMLError(), CHAR, DWORD, EnterDDECrit, HSZT_INVALID, L, LATOM_FROM_HSZ, LeaveDDECrit, NULL, SetLastDDEMLError(), UINT, ValidateHSZ(), and ValidateInstance().

Referenced by DdeQueryStringA(), and DdeQueryStringW().

00147 { 00148 PCL_INSTANCE_INFO pcii; 00149 DWORD dwRet = 0; 00150 WCHAR szw[256]; 00151 // BOOL fDefUsed; // LATER 00152 00153 EnterDDECrit; 00154 00155 pcii = ValidateInstance((HANDLE)LongToHandle( idInst )); 00156 if (pcii == NULL) { 00157 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00158 goto Exit; 00159 } 00160 00161 if (ValidateHSZ(hsz) == HSZT_INVALID) { 00162 SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER); 00163 goto Exit; 00164 } 00165 00166 if (LATOM_FROM_HSZ(hsz) == 0) { 00167 if (iCodePage == CP_WINUNICODE) { 00168 if (psz != NULL) { 00169 *(LPWSTR)psz = L'\0'; 00170 } 00171 dwRet = sizeof(WCHAR); 00172 goto Exit; 00173 } else { 00174 if (psz != NULL) { 00175 *(LPSTR)psz = '\0'; 00176 } 00177 dwRet = sizeof(CHAR); 00178 goto Exit; 00179 } 00180 } 00181 00182 if (psz == NULL) { 00183 cbMax = sizeof(szw); 00184 psz = (PVOID)szw; 00185 } 00186 00187 switch (iCodePage) { 00188 case CP_WINANSI: 00189 dwRet = GetAtomNameA(LATOM_FROM_HSZ(hsz), psz, cbMax); 00190 break; 00191 00192 default: 00193 dwRet = GetAtomNameW(LATOM_FROM_HSZ(hsz), (LPWSTR)psz, cbMax / sizeof(WCHAR)); 00194 if (iCodePage != CP_WINUNICODE) { 00195 00196 /* 00197 * convert psz to the appropriate codepage and count the 00198 * characters(ie BYTES for DBCS!) to alter dwRet. 00199 */ 00200 #ifdef LATER 00201 // Does this routine work in place? (i.e. input and output buffer the same). 00202 WideCharToMultiByte((UINT)iCodePage, 0, szw, 00203 sizeof(szw) / sizeof(WCHAR), 00204 (LPSTR)psz, cbMax, NULL, &fDefUsed); 00205 #endif 00206 dwRet = cbMax + 1; 00207 } 00208 break; 00209 } 00210 00211 Exit: 00212 LeaveDDECrit; 00213 return (dwRet); 00214 }

GATOM LocalToGlobalAtom LATOM  la  ) 
 

Definition at line 438 of file hsz.c.

References GATOM.

Referenced by ConnectConv(), DdeClientTransaction(), DdeNameService(), DdeReconnect(), DoCallback(), FreeConversationResources(), MonitorConv(), MonitorLink(), ProcessDDEMLInitiate(), and UpdateLinkIfChanged().

00440 { 00441 WCHAR sz[256]; 00442 00443 if (la == 0) { 00444 return (0); 00445 } 00446 if (GetAtomName((ATOM)la, sz, 256) == 0) { 00447 RIPMSG0(RIP_WARNING, "LocalToGlobalAtom out of memory"); 00448 return (0); 00449 } 00450 return ((GATOM)GlobalAddAtom(sz)); 00451 }

LATOM MakeInstSpecificAtom LATOM  la,
HWND  hwnd
 

Definition at line 367 of file hsz.c.

References LATOM, and strlen().

Referenced by ProcessRegistrationMessage().

00370 { 00371 WCHAR sz[256]; 00372 LPWSTR psz; 00373 00374 if (GetAtomName(la, sz, 256) == 0) { 00375 return (0); 00376 } 00377 #ifdef UNICODE 00378 psz = sz + wcslen(sz); 00379 #else 00380 psz = sz + strlen(sz); 00381 #endif 00382 wsprintf(psz, TEXT("(%#p)"), hwnd); 00383 la = AddAtom(sz); 00384 return (la); 00385 }

HWND ParseInstSpecificAtom LATOM  la,
LATOM plaNormal
 

Definition at line 398 of file hsz.c.

References CHAR, and NULL.

Referenced by ValidateConnectParameters().

00401 { 00402 CHAR sz[256]; 00403 LPSTR pszHwnd; 00404 HWND hwnd; 00405 00406 /* 00407 * LATER- NEED TO MAKE THIS UNICODE BASED WHEN WE GET A SCANF WE CAN USE 00408 */ 00409 if (GetAtomNameA(la, sz, 256) == 0) { 00410 return (0); 00411 } 00412 pszHwnd = strrchr(sz, '('); 00413 if (pszHwnd == NULL) { 00414 return (0); 00415 } 00416 if (sscanf(pszHwnd, "(%#p)", &hwnd) != 1) { 00417 return (0); 00418 } 00419 if (plaNormal != NULL) { 00420 *pszHwnd = '\0'; 00421 *plaNormal = AddAtomA(sz); 00422 } 00423 return (hwnd); 00424 }

DWORD ValidateHSZ HSZ  hsz  ) 
 

Definition at line 340 of file hsz.c.

References DWORD, HSZT_INST_SPECIFIC, HSZT_INVALID, and HSZT_NORMAL.

Referenced by DdeFreeStringHandle(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), InternalDdeQueryString(), and ValidateConnectParameters().

00342 { 00343 if (hsz == 0) { 00344 return (HSZT_NORMAL); 00345 } 00346 if (LOWORD((ULONG_PTR)hsz) < 0xC000) { 00347 return (HSZT_INVALID); 00348 } 00349 if (HIWORD((ULONG_PTR)hsz) == 0) { 00350 return (HSZT_NORMAL); 00351 } 00352 if (HIWORD((ULONG_PTR)hsz) == 1) { 00353 return (HSZT_INST_SPECIFIC); 00354 } 00355 return (HSZT_INVALID); 00356 }


Generated on Sat May 15 19:44:06 2004 for test by doxygen 1.3.7