MCPcopy Create free account
hub / github.com/acl-dev/acl / AutoRun

Method AutoRun

app/jaws/JawsCtrl/lib_ctrl/RegRun.cpp:28–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26static char sKey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
27
28BOOL CRegRun::AutoRun(BOOL bAutoRun, const char *procname)
29{
30 CRegKey regRun;
31 int ret;
32
33 if (bAutoRun) {
34 if (!IfAutoRun()) {
35 ret = regRun.Create(HKEY_LOCAL_MACHINE, sKey);
36 if (ret == ERROR_SUCCESS) {
37 regRun.SetStringValue(m_sRegName.GetString(), procname, REG_SZ);
38 regRun.Close();
39 } else {
40 m_sErrMsg.Format("CRegKey::Create sKey(%s) error(%d)", sKey, ret);
41 m_nErrno = ret;
42 return FALSE;
43 }
44 }
45 } else {
46 ret = regRun.Open(HKEY_LOCAL_MACHINE, sKey, KEY_ALL_ACCESS);
47 if (ret == ERROR_SUCCESS) {
48 regRun.DeleteValue(m_sRegName.GetString());
49 regRun.Close();
50 } else {
51 m_sErrMsg.Format("CRegKey::Open sKey(%s) error(%d)", sKey, ret);
52 m_nErrno = ret;
53 return FALSE;
54 }
55 }
56
57 return TRUE;
58}
59
60BOOL CRegRun::IfAutoRun()
61{

Callers 1

OnBnClickedAutoRunMethod · 0.80

Calls 2

CloseMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected