NSIS WriteRegSTR或WriteRegDword

时间:2017-10-11 09:36:38

标签: nsis

我正在尝试写入reg并且似乎无法找到正确的方法。

HKEY_LOCAL_MACHINE
"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "XboxStat" '"C:\\Program Files\\Microsoft Xbox 360 Accessories\\XboxStat.exe\" silentrun'
"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "Hyperspin" "D:\\Arcade\\Hyperspin.exe\"

我试过了:

WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "Hyperspin" "D:\\Arcade\\Hyperspin.exe\"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "Hyperspin" "D:\\Arcade\\Hyperspin.exe\"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "Hyperspin" "D:\\Arcade\\Hyperspin.exe\"
WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "Hyperspin" "D:\\Arcade\\Hyperspin.exe\"

但是没有任何东西出现在reg。

1 个答案:

答案 0 :(得分:0)

1)您的安装人员需要run as a elevated administrator写信给HKLM。将public ArrayList<String> nameOfEvent = new ArrayList<String>(); public ArrayList<String> startDates = new ArrayList<String>(); public ArrayList<String> descriptions = new ArrayList<String>(); public Multimap<String, String> multimap = ArrayListMultimap.create(); public ArrayList<String> readCalendarEvent(Context context) { Cursor cursor = context.getContentResolver() .query( Uri.parse("content://com.android.calendar/events"), new String[]{"calendar_id", "title", "description", "dtstart", "dtend", "eventLocation"}, null, null, null); cursor.moveToFirst(); // fetching calendars name String CNames[] = new String[cursor.getCount()]; // fetching calendars id nameOfEvent.clear(); startDates.clear(); //endDates.clear(); descriptions.clear(); for (int i = 0; i < CNames.length; i++) { String test = cursor.getString(0); nameOfEvent.add(cursor.getString(1)); startDates.add(getDate(Long.parseLong(cursor.getString(3)))); // endDates.add(getDate(Long.parseLong(cursor.getString(4)))); descriptions.add(cursor.getString(2)); multimap.put(getDate(Long.parseLong(cursor.getString(3))), getTime(Long.parseLong(cursor.getString(3)))); CNames[i] = cursor.getString(1); cursor.moveToNext(); } return nameOfEvent; } public String getDate(long milliSeconds) { SimpleDateFormat formatter = new SimpleDateFormat( "dd/MM/yyyy"); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); } public String getTime(long milliSeconds) { SimpleDateFormat formatter = new SimpleDateFormat( "hh:mm:ss"); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); } 添加到您的脚本中。

2)在64位Windows上有two different views个注册表,默认情况下,32位应用程序会在&#34; real&#34;中写入RequestExecutionLevel Admin键。您在RegEdit中看到的注册表。使用NSIS中的SetRegView写入64位注册表。