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_language_table_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 language table load       */
44 /*    function.                                                           */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    root_address                          Root address of binary        */
49 /*                                            resource data               */
50 /*    returned_language_table               Pointer to loaded language    */
51 /*                                           table                        */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    status                                Completion status             */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _gx_binres_language_table_load        The actual binres language    */
60 /*                                            table load function         */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
75 #ifdef GX_BINARY_RESOURCE_SUPPORT
76 #ifdef GX_ENABLE_DEPRECATED_STRING_API
_gxe_binres_language_table_load(GX_UBYTE * root_address,GX_UBYTE **** returned_language_table)77 UINT _gxe_binres_language_table_load(GX_UBYTE *root_address, GX_UBYTE ****returned_language_table)
78 {
79 UINT status;
80 
81     if ((root_address == GX_NULL) || (returned_language_table == GX_NULL))
82     {
83         return GX_PTR_ERROR;
84     }
85 
86     if ((_gx_system_memory_allocator == GX_NULL) ||
87         (_gx_system_memory_free == GX_NULL))
88     {
89         return GX_SYSTEM_MEMORY_ERROR;
90     }
91 
92     status = _gx_binres_language_table_load(root_address, returned_language_table);
93 
94     /* Return completion status code. */
95     return(status);
96 }
97 #endif
98 #endif
99 
100 /**************************************************************************/
101 /*                                                                        */
102 /*  FUNCTION                                               RELEASE        */
103 /*                                                                        */
104 /*    _gxe_binres_language_table_load_ext                 PORTABLE C      */
105 /*                                                           6.1          */
106 /*  AUTHOR                                                                */
107 /*                                                                        */
108 /*    Kenneth Maxwell, Microsoft Corporation                              */
109 /*                                                                        */
110 /*  DESCRIPTION                                                           */
111 /*                                                                        */
112 /*    This function checks for errors in binres language table load       */
113 /*    function.                                                           */
114 /*                                                                        */
115 /*  INPUT                                                                 */
116 /*                                                                        */
117 /*    root_address                          Root address of binary        */
118 /*                                            resource data               */
119 /*    returned_language_table               Pointer to loaded language    */
120 /*                                           table                        */
121 /*                                                                        */
122 /*  OUTPUT                                                                */
123 /*                                                                        */
124 /*    status                                Completion status             */
125 /*                                                                        */
126 /*  CALLS                                                                 */
127 /*                                                                        */
128 /*    _gx_binres_language_table_load_ext    The actual binres language    */
129 /*                                            table load function         */
130 /*                                                                        */
131 /*  CALLED BY                                                             */
132 /*                                                                        */
133 /*    Application Code                                                    */
134 /*                                                                        */
135 /*  RELEASE HISTORY                                                       */
136 /*                                                                        */
137 /*    DATE              NAME                      DESCRIPTION             */
138 /*                                                                        */
139 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
140 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
141 /*                                            resulting in version 6.1    */
142 /*                                                                        */
143 /**************************************************************************/
144 #ifdef GX_BINARY_RESOURCE_SUPPORT
_gxe_binres_language_table_load_ext(GX_UBYTE * root_address,GX_STRING *** returned_language_table)145 UINT _gxe_binres_language_table_load_ext(GX_UBYTE *root_address, GX_STRING ***returned_language_table)
146 {
147 UINT status;
148 
149     if ((root_address == GX_NULL) || (returned_language_table == GX_NULL))
150     {
151         return GX_PTR_ERROR;
152     }
153 
154     if ((_gx_system_memory_allocator == GX_NULL) ||
155         (_gx_system_memory_free == GX_NULL))
156     {
157         return GX_SYSTEM_MEMORY_ERROR;
158     }
159 
160     status = _gx_binres_language_table_load_ext(root_address, returned_language_table);
161 
162     /* Return completion status code. */
163     return(status);
164 }
165 #endif
166 
167