@@ -23,16 +23,26 @@ static void* g_stub_memory = NULL;
2323// clang-format off
2424
2525// Number of Google Analytics functions expected to be loaded from the DLL.
26- const int FirebaseAnalytics_DynamicFunctionCount = 19 ;
26+ const int FirebaseAnalytics_DynamicFunctionCount = 22 ;
2727
2828#if defined(_WIN32 )
29- // Google Analytics Windows DLL SHA256 hash, to be verified on load .
30- const unsigned char FirebaseAnalytics_WindowsDllHash [] = {
31- 0xc1 , 0xb9 , 0xff , 0x6e , 0x91 , 0x19 , 0xc3 , 0x0b , 0xbe , 0xb7 , 0x47 , 0x23 , 0x26 , 0xdc , 0xde , 0x41 , 0x8f , 0x45 , 0x68 , 0x2e , 0x6b , 0x82 , 0x2e , 0x25 , 0xee , 0xd9 , 0x22 , 0xfe , 0x6e , 0x3c , 0xc6 , 0x98
29+ // Array of known Google Analytics Windows DLL SHA256 hashes (hex strings) .
30+ const char * FirebaseAnalytics_KnownWindowsDllHashes [] = {
31+ "13ae5f9349b24186f1f3667b52832076e8d14ad9656c3546b1b7fca79ac8144b"
3232};
3333#endif // defined(_WIN32)
3434
3535// --- Stub Function Definitions ---
36+ // Stub for GoogleAnalytics_Options_Create
37+ static GoogleAnalytics_Options * Stub_GoogleAnalytics_Options_Create () {
38+ return (GoogleAnalytics_Options * )(& g_stub_memory );
39+ }
40+
41+ // Stub for GoogleAnalytics_Options_Destroy
42+ static void Stub_GoogleAnalytics_Options_Destroy (GoogleAnalytics_Options * options ) {
43+ // No return value.
44+ }
45+
3646// Stub for GoogleAnalytics_Item_Create
3747static GoogleAnalytics_Item * Stub_GoogleAnalytics_Item_Create () {
3848 return (GoogleAnalytics_Item * )(& g_stub_memory );
@@ -113,6 +123,11 @@ static void Stub_GoogleAnalytics_EventParameters_Destroy(GoogleAnalytics_EventPa
113123 // No return value.
114124}
115125
126+ // Stub for GoogleAnalytics_Initialize
127+ static bool Stub_GoogleAnalytics_Initialize (const GoogleAnalytics_Options * options ) {
128+ return 1 ;
129+ }
130+
116131// Stub for GoogleAnalytics_LogEvent
117132static void Stub_GoogleAnalytics_LogEvent (const char * name , GoogleAnalytics_EventParameters * parameters ) {
118133 // No return value.
@@ -141,6 +156,8 @@ static void Stub_GoogleAnalytics_SetAnalyticsCollectionEnabled(bool enabled) {
141156
142157
143158// --- Function Pointer Initializations ---
159+ GoogleAnalytics_Options * (* ptr_GoogleAnalytics_Options_Create )() = & Stub_GoogleAnalytics_Options_Create ;
160+ void (* ptr_GoogleAnalytics_Options_Destroy )(GoogleAnalytics_Options * options ) = & Stub_GoogleAnalytics_Options_Destroy ;
144161GoogleAnalytics_Item * (* ptr_GoogleAnalytics_Item_Create )() = & Stub_GoogleAnalytics_Item_Create ;
145162void (* ptr_GoogleAnalytics_Item_InsertInt )(GoogleAnalytics_Item * item , const char * key , int64_t value ) = & Stub_GoogleAnalytics_Item_InsertInt ;
146163void (* ptr_GoogleAnalytics_Item_InsertDouble )(GoogleAnalytics_Item * item , const char * key , double value ) = & Stub_GoogleAnalytics_Item_InsertDouble ;
@@ -155,6 +172,7 @@ void (*ptr_GoogleAnalytics_EventParameters_InsertDouble)(GoogleAnalytics_EventPa
155172void (* ptr_GoogleAnalytics_EventParameters_InsertString )(GoogleAnalytics_EventParameters * event_parameter_map , const char * key , const char * value ) = & Stub_GoogleAnalytics_EventParameters_InsertString ;
156173void (* ptr_GoogleAnalytics_EventParameters_InsertItemVector )(GoogleAnalytics_EventParameters * event_parameter_map , const char * key , GoogleAnalytics_ItemVector * value ) = & Stub_GoogleAnalytics_EventParameters_InsertItemVector ;
157174void (* ptr_GoogleAnalytics_EventParameters_Destroy )(GoogleAnalytics_EventParameters * event_parameter_map ) = & Stub_GoogleAnalytics_EventParameters_Destroy ;
175+ bool (* ptr_GoogleAnalytics_Initialize )(const GoogleAnalytics_Options * options ) = & Stub_GoogleAnalytics_Initialize ;
158176void (* ptr_GoogleAnalytics_LogEvent )(const char * name , GoogleAnalytics_EventParameters * parameters ) = & Stub_GoogleAnalytics_LogEvent ;
159177void (* ptr_GoogleAnalytics_SetUserProperty )(const char * name , const char * value ) = & Stub_GoogleAnalytics_SetUserProperty ;
160178void (* ptr_GoogleAnalytics_SetUserId )(const char * user_id ) = & Stub_GoogleAnalytics_SetUserId ;
@@ -170,6 +188,16 @@ int FirebaseAnalytics_LoadDynamicFunctions(HMODULE dll_handle) {
170188 return count ;
171189 }
172190
191+ FARPROC proc_GoogleAnalytics_Options_Create = GetProcAddress (dll_handle , "GoogleAnalytics_Options_Create" );
192+ if (proc_GoogleAnalytics_Options_Create ) {
193+ ptr_GoogleAnalytics_Options_Create = (GoogleAnalytics_Options * (* )())proc_GoogleAnalytics_Options_Create ;
194+ count ++ ;
195+ }
196+ FARPROC proc_GoogleAnalytics_Options_Destroy = GetProcAddress (dll_handle , "GoogleAnalytics_Options_Destroy" );
197+ if (proc_GoogleAnalytics_Options_Destroy ) {
198+ ptr_GoogleAnalytics_Options_Destroy = (void (* )(GoogleAnalytics_Options * options ))proc_GoogleAnalytics_Options_Destroy ;
199+ count ++ ;
200+ }
173201 FARPROC proc_GoogleAnalytics_Item_Create = GetProcAddress (dll_handle , "GoogleAnalytics_Item_Create" );
174202 if (proc_GoogleAnalytics_Item_Create ) {
175203 ptr_GoogleAnalytics_Item_Create = (GoogleAnalytics_Item * (* )())proc_GoogleAnalytics_Item_Create ;
@@ -240,6 +268,11 @@ int FirebaseAnalytics_LoadDynamicFunctions(HMODULE dll_handle) {
240268 ptr_GoogleAnalytics_EventParameters_Destroy = (void (* )(GoogleAnalytics_EventParameters * event_parameter_map ))proc_GoogleAnalytics_EventParameters_Destroy ;
241269 count ++ ;
242270 }
271+ FARPROC proc_GoogleAnalytics_Initialize = GetProcAddress (dll_handle , "GoogleAnalytics_Initialize" );
272+ if (proc_GoogleAnalytics_Initialize ) {
273+ ptr_GoogleAnalytics_Initialize = (bool (* )(const GoogleAnalytics_Options * options ))proc_GoogleAnalytics_Initialize ;
274+ count ++ ;
275+ }
243276 FARPROC proc_GoogleAnalytics_LogEvent = GetProcAddress (dll_handle , "GoogleAnalytics_LogEvent" );
244277 if (proc_GoogleAnalytics_LogEvent ) {
245278 ptr_GoogleAnalytics_LogEvent = (void (* )(const char * name , GoogleAnalytics_EventParameters * parameters ))proc_GoogleAnalytics_LogEvent ;
@@ -270,6 +303,8 @@ int FirebaseAnalytics_LoadDynamicFunctions(HMODULE dll_handle) {
270303}
271304
272305void FirebaseAnalytics_UnloadDynamicFunctions (void ) {
306+ ptr_GoogleAnalytics_Options_Create = & Stub_GoogleAnalytics_Options_Create ;
307+ ptr_GoogleAnalytics_Options_Destroy = & Stub_GoogleAnalytics_Options_Destroy ;
273308 ptr_GoogleAnalytics_Item_Create = & Stub_GoogleAnalytics_Item_Create ;
274309 ptr_GoogleAnalytics_Item_InsertInt = & Stub_GoogleAnalytics_Item_InsertInt ;
275310 ptr_GoogleAnalytics_Item_InsertDouble = & Stub_GoogleAnalytics_Item_InsertDouble ;
@@ -284,6 +319,7 @@ void FirebaseAnalytics_UnloadDynamicFunctions(void) {
284319 ptr_GoogleAnalytics_EventParameters_InsertString = & Stub_GoogleAnalytics_EventParameters_InsertString ;
285320 ptr_GoogleAnalytics_EventParameters_InsertItemVector = & Stub_GoogleAnalytics_EventParameters_InsertItemVector ;
286321 ptr_GoogleAnalytics_EventParameters_Destroy = & Stub_GoogleAnalytics_EventParameters_Destroy ;
322+ ptr_GoogleAnalytics_Initialize = & Stub_GoogleAnalytics_Initialize ;
287323 ptr_GoogleAnalytics_LogEvent = & Stub_GoogleAnalytics_LogEvent ;
288324 ptr_GoogleAnalytics_SetUserProperty = & Stub_GoogleAnalytics_SetUserProperty ;
289325 ptr_GoogleAnalytics_SetUserId = & Stub_GoogleAnalytics_SetUserId ;
0 commit comments