annotate src/VisVim/Reg.cpp @ 28897:37e05627acb1 v8.2.4971

patch 8.2.4971: Vim9: interpolated string seen as range Commit: https://github.com/vim/vim/commit/40c141d333292d625907f4de13766cbbc2223911 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 17 13:14:23 2022 +0100 patch 8.2.4971: Vim9: interpolated string seen as range Problem: Vim9: interpolated string seen as range. Solution: Recognize an interpolated string at the start of a command line. (closes #10434)
author Bram Moolenaar <Bram@vim.org>
date Tue, 17 May 2022 14:15:02 +0200
parents 3fc0f57ecb91
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 #include "stdafx.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 // Returns key for HKEY_CURRENT_USER\"Software"\Company\AppName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 // creating it if it doesn't exist
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 // responsibility of the caller to call RegCloseKey() on the returned HKEY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 HKEY GetAppKey (char* AppName)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 HKEY hAppKey = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 HKEY hSoftKey = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 if (RegOpenKeyEx (HKEY_CURRENT_USER, "Software", 0, KEY_WRITE | KEY_READ,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 &hSoftKey) == ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 DWORD Dummy;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 RegCreateKeyEx (hSoftKey, AppName, 0, REG_NONE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_READ, NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 &hAppKey, &Dummy);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 if (hSoftKey)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 RegCloseKey (hSoftKey);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 return hAppKey;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 // Returns key for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 // HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\Section
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 // creating it if it doesn't exist.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 // responsibility of the caller to call RegCloseKey () on the returned HKEY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 HKEY GetSectionKey (HKEY hAppKey, LPCTSTR Section)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 HKEY hSectionKey = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 DWORD Dummy;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 RegCreateKeyEx (hAppKey, Section, 0, REG_NONE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 &hSectionKey, &Dummy);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 return hSectionKey;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 int GetRegistryInt (HKEY hSectionKey, LPCTSTR Entry, int Default)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 DWORD Value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 DWORD Type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 DWORD Count = sizeof (DWORD);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 if (RegQueryValueEx (hSectionKey, (LPTSTR) Entry, NULL, &Type,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 (LPBYTE) &Value, &Count) == ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 return Value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 return Default;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 bool WriteRegistryInt (HKEY hSectionKey, char* Entry, int nValue)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 return RegSetValueEx (hSectionKey, Entry, NULL, REG_DWORD,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 (LPBYTE) &nValue, sizeof (nValue)) == ERROR_SUCCESS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56