1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Binres Loader Management (Binres Loader)                            */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_binres_loader.h"
28 #include "gx_system.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_binres_theme_load                              PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in binres theme load function.      */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    root_address                          Root address of binary        */
48 /*                                            resource data               */
49 /*    theme_id                              The indentifier of the theme  */
50 /*    returned_theme                        Pointer to loaded theme       */
51 /*                                                                        */
52 /*  OUTPUT                                                                */
53 /*                                                                        */
54 /*    status                                Completion status             */
55 /*                                                                        */
56 /*  CALLS                                                                 */
57 /*                                                                        */
58 /*    _gx_binres_theme_read                 The actual binres theme read  */
59 /*                                            function                    */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    Application Code                                                    */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71 /*                                            resulting in version 6.1    */
72 /*                                                                        */
73 /**************************************************************************/
74 #ifdef GX_BINARY_RESOURCE_SUPPORT
_gxe_binres_theme_load(GX_UBYTE * root_address,INT theme_id,GX_THEME ** returned_theme)75 UINT _gxe_binres_theme_load(GX_UBYTE *root_address, INT theme_id, GX_THEME **returned_theme)
76 {
77 UINT  status;
78 
79     if ((root_address == GX_NULL) || (returned_theme == GX_NULL))
80     {
81         return GX_PTR_ERROR;
82     }
83 
84     if (theme_id < 0)
85     {
86         return GX_INVALID_VALUE;
87     }
88 
89     if ((_gx_system_memory_allocator == GX_NULL) ||
90         (_gx_system_memory_free == GX_NULL))
91     {
92         return GX_SYSTEM_MEMORY_ERROR;
93     }
94 
95     status = _gx_binres_theme_load(root_address, theme_id, returned_theme);
96 
97     /* Return completion status code. */
98     return(status);
99 }
100 #endif
101