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 /**   System Management (System)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 
29 /* Bring in externs for caller checking code.  */
30 GX_CALLER_CHECKING_EXTERNS
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_system_timer_stop                              PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function checks for errors in system timer stop call.          */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    owner                                 Pointer to widget control     */
49 /*                                            block                       */
50 /*    timer_id                              ID of timer                   */
51 /*                                                                        */
52 /*  OUTPUT                                                                */
53 /*                                                                        */
54 /*    status                                Completion status             */
55 /*                                                                        */
56 /*  CALLS                                                                 */
57 /*                                                                        */
58 /*    _gx_system_timer_stop                 Actual system timer stop call */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    GUIX Application                                                    */
63 /*                                                                        */
64 /*  RELEASE HISTORY                                                       */
65 /*                                                                        */
66 /*    DATE              NAME                      DESCRIPTION             */
67 /*                                                                        */
68 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
69 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
70 /*                                            resulting in version 6.1    */
71 /*                                                                        */
72 /**************************************************************************/
_gxe_system_timer_stop(GX_WIDGET * owner,UINT timer_id)73 UINT _gxe_system_timer_stop(GX_WIDGET *owner, UINT timer_id)
74 {
75 UINT      status;
76 GX_TIMER *next;
77 GX_BOOL   id_flag = GX_FALSE;
78 
79     /* Check for invalid caller.  */
80     GX_INIT_AND_THREADS_CALLER_CHECKING
81 
82     /* Check for timer ID not found.  */
83 
84     if (timer_id)
85     {
86         next = _gx_system_active_timer_list;
87         while (next)
88         {
89             if (next -> gx_timer_id == timer_id)
90             {
91                 id_flag = GX_TRUE;
92                 break;
93             }
94             next = next -> gx_timer_next;
95         }
96         if (id_flag == GX_FALSE)
97         {
98             return(GX_NOT_FOUND);
99         }
100     }
101 
102     /* Check for invalid pointer.  */
103     if (owner == GX_NULL)
104     {
105         return(GX_PTR_ERROR);
106     }
107 
108     /* Check for invalid widget.  */
109     if (owner -> gx_widget_type == 0)
110     {
111         return(GX_INVALID_WIDGET);
112     }
113 
114     /* Call actual system timer stop.  */
115     status = _gx_system_timer_stop(owner, timer_id);
116 
117     /* Return status.  */
118     return(status);
119 }
120 
121