MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / validateProductSuite

Function validateProductSuite

src/common/utils.cpp:846–885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844////////////////////////////////////////////////////////////
845
846bool validateProductSuite (LPCSTR lpszSuiteToValidate)
847{
848 NTRegQuery query;
849
850 // Open the ProductOptions key.
851 if (!query.openForRead("System\\CurrentControlSet\\Control\\ProductOptions"))
852 return false;
853
854 // Determine required size of ProductSuite buffer.
855 // If we get size == 1 it means multi string data with only a terminator.
856 if (!query.readValueSize("ProductSuite") || query.getDataSize() < 2)
857 return false;
858
859 // Allocate buffer.
860 NTLocalString lpszProductSuites(query.getDataSize());
861 if (!lpszProductSuites.allocated())
862 return false;
863
864 // Retrieve array of product suite strings.
865 if (!query.readValueData(lpszProductSuites.getString()) || query.getDataType() != REG_MULTI_SZ)
866 return false;
867
868 query.close(); // explicit but redundant.
869
870 // Search for suite name in array of strings.
871 bool fValidated = false;
872 LPCSTR lpszSuite = lpszProductSuites.c_str();
873 LPCSTR end = lpszSuite + query.getDataSize(); // paranoid check
874 while (*lpszSuite && lpszSuite < end)
875 {
876 if (lstrcmpA(lpszSuite, lpszSuiteToValidate) == 0)
877 {
878 fValidated = true;
879 break;
880 }
881 lpszSuite += (lstrlenA(lpszSuite) + 1);
882 }
883
884 return fValidated;
885}
886
887#endif // WIN_NT
888

Callers 1

isGlobalKernelPrefixFunction · 0.85

Calls 9

openForReadMethod · 0.80
readValueSizeMethod · 0.80
getDataSizeMethod · 0.80
allocatedMethod · 0.80
readValueDataMethod · 0.80
getDataTypeMethod · 0.80
getStringMethod · 0.45
closeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected