DAS  3.1.6 - 18/09/2017
PWD.C
Go to the documentation of this file.
1 
2 
11 #include <io.h>
12 #include <fcntl.h>
13 #include <sys/types.h>
14 #include <sys/stat.h>
15 #include <windows.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include "mgui.h"
20 #include "DAS_Spatram.h"
21 
22 
23 
24 //lis LIS; //LIS
25 
26 
27 //extern int Flg1AskPWD;
28 short int NumRip = 0;
29 //int FlgSh_PWD = 1;
30 //int ROwnPwdOk = 1;
31 //int OwnPwdOk = 1;
32 /*
33  * External User Defined Callbacks
34  */
35 /*****************************************************
36  * This Callback is called by the EDIT when the
37  * 'Enter' key is pressed.
38  *****************************************************/
39 void ActPWDSysCB(MOBJECT edit, char *text, void *ed)
40 {
41  static int notify;
42  char DefPwdSys[10]="nefertari";
43 
44  int DefPwdOk;
45 /*
46  * When 'notify' is True, the EDIT 'ed' calls
47  * the 'ValueChange' and 'NewValue' Callbacks
48  */
49 
50  sprintf(DefPwdSys, "%s","nefertari"); //Sistem Paswd
51 
52  DefPwdOk = strcmp( DefPwdSys, text );
53  if(DefPwdOk == 0)
54  {
55 
56  DPWD.FlgSh_PWD = 0;
57  DPWD.PwdOK = 0;
58  }
59  else
60  {
61  NumRip++;
62  if (NumRip == 3)
63  {
64 
65  DPWD.FlgSh_PWD = 0;
66  DPWD.PwdOK = 1;
67  NumRip = 0;
68 
69  }
70  sprintf(text, "", "");
71  notify ^= 1;
72  MEditSetTextExt((MOBJECT) ed, text, False, notify);
73  }
74 
75 // NumRip++;
76 // if (NumRip == 3)
77 // {
78 
79 // DPWD.FlgSh_PWD = 1;
80 // DPWD.PwdOK = 1;
81 
82 // }
83 
84 }
85 
86 
87 
88 /*
89  * Global Variables
90  */
91 
92 /*
93  * Shell creation prototypes
94  */
95 
96 /*
97  * Project Defined Callbacks
98  */
99 
100 /*
101  * Shell creation functions
102  */
103 
104 
106 {
107 
108 
109  MOBJECT _rowform000;
110  MOBJECT _label000;
111  MOBJECT _edit000;
112  DAS.Gui.Shells.Sh_PWD = MCreateShell("SYSTEM PWD", SF_MODAL);
113 
114  _rowform000 = MCreateRowForm(DAS.Gui.Shells.Sh_PWD);
115  MObjectSetForegroundRGB(_rowform000, 88, 80, 96);
116  MObjectSetBackgroundRGB(_rowform000, 88, 80, 96);
117  MObjectSetResize(_rowform000, True, True);
118 
119  _label000 = MCreateLabel(_rowform000, "Please insert the system password", FIXED_SMALL);
120  MObjectSetForegroundRGB(_label000, 255, 255, 0);
121 
122  _edit000 = MCreateHiddenEdit(_rowform000, "", 15, FIXED_MEDIUM, '*');
123  MEditSetFilter(_edit000, 1, "");
124  MObjectSetForegroundRGB(_edit000, 255, 255, 255);
125  MObjectSetBackgroundRGB(_edit000, 0, 0, 0);
126  MEditSetActCallback(_edit000, ActPWDSysCB, _edit000);
127 
129 
131 
135 
136  return DPWD.PwdOK;
137 
138 }
139 
dpwd DPWD
Definition: CreateForms.c:79
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
gui Gui
Graphic User Interface Structure.
shells Shells
Shells structure.
void MShellRealize(MOBJECT obj)
void MEditSetTextExt(MOBJECT edit, const char *text, int validated, int notify)
int PwdOK
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
void MObjectSetResize(MOBJECT obj, int resize_w, int resize_h)
#define False
Definition: Mguidefs.h:236
int FlgSh_PWD
das DAS
Definition: Chktemp.c:26
void MShellUnrealize(MOBJECT obj)
void MShellDestroy(MOBJECT obj)
#define FIXED_MEDIUM
Definition: Mguidefs.h:879
int MDCreateSh_PWD()
Password shell. Procedure that build the shell for the System password in order to access the control...
Definition: PWD.C:105
void MEditSetActCallback(MOBJECT edit, OBJ_STRING_CB cb, void *data)
#define FIXED_SMALL
Definition: Mguidefs.h:878
#define SF_MODAL
Definition: Mguidefs.h:1019
MOBJECT MCreateHiddenEdit(MOBJECT parent, const char *text, int len, MTFont font, char shown_char)
short int NumRip
Definition: PWD.C:28
MOBJECT MCreateShell(const char *title, int flags)
void MShellRaise(MOBJECT obj)
void ActPWDSysCB(MOBJECT edit, char *text, void *ed)
Definition: PWD.C:39
Function prototypes.
void MEditSetFilter(MOBJECT edit, int filter, const char *extra_chars)
void * MOBJECT
Definition: Mguidefs.h:192
#define True
Definition: Mguidefs.h:235
MOBJECT Sh_PWD
Password Shell.
void MLoopWhileFlag(int *pflag, int value)
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT MCreateRowForm(MOBJECT parent)
______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:44:09 for DAS - Rel. 3.1.6 - 18/09/2017.