MCPcopy Create free account
hub / github.com/Tencent/mars / QueryStringValue

Method QueryStringValue

samples/Windows/WTL/atlapp.h:1911–1947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1909 }
1910
1911 LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars)
1912 {
1913 ATLASSERT(m_hKey != NULL);
1914 ATLASSERT(pnChars != NULL);
1915
1916 ULONG nBytes = (*pnChars) * sizeof(TCHAR);
1917 DWORD dwType = 0;
1918 *pnChars = 0;
1919 LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast<LPBYTE>(pszValue), &nBytes);
1920
1921 if (lRes != ERROR_SUCCESS)
1922 {
1923 return lRes;
1924 }
1925
1926 if(dwType != REG_SZ && dwType != REG_EXPAND_SZ)
1927 {
1928 return ERROR_INVALID_DATA;
1929 }
1930
1931 if (pszValue != NULL)
1932 {
1933 if(nBytes != 0)
1934 {
1935 if ((nBytes % sizeof(TCHAR) != 0) || (pszValue[nBytes / sizeof(TCHAR) -1] != 0))
1936 return ERROR_INVALID_DATA;
1937 }
1938 else
1939 {
1940 pszValue[0] = _T('\0');
1941 }
1942 }
1943
1944 *pnChars = nBytes / sizeof(TCHAR);
1945
1946 return ERROR_SUCCESS;
1947 }
1948
1949 LONG QueryMultiStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars)
1950 {

Callers 3

RestoreMethod · 0.80
InitFunction · 0.80
ReadFromRegistryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected