| 1 | // Copyright 2016 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Package sysdll is an internal leaf package that records and reports |
| 6 | // which Windows DLL names are used by Go itself. These DLLs are then |
| 7 | // only loaded from the System32 directory. See Issue 14959. |
| 8 | package sysdll |
| 9 | |
| 10 | // IsSystemDLL reports whether the named dll key (a base name, like |
| 11 | // "foo.dll") is a system DLL which should only be loaded from the |
| 12 | // Windows SYSTEM32 directory. |
| 13 | // |
| 14 | // Filenames are case sensitive, but that doesn't matter because |
| 15 | // the case registered with Add is also the same case used with |
| 16 | // LoadDLL later. |
| 17 | // |
| 18 | // It has no associated mutex and should only be mutated serially |
| 19 | // (currently: during init), and not concurrent with DLL loading. |
| 20 | var IsSystemDLL = map[string]bool{} |
| 21 | |
| 22 | // Add notes that dll is a system32 DLL which should only be loaded |
| 23 | // from the Windows SYSTEM32 directory. It returns its argument back, |
| 24 | // for ease of use in generated code. |
| 25 | func Add(dll string) string { |
| 26 | IsSystemDLL[dll] = true |
| 27 | return dll |
| 28 | } |