コード例 #1
0
ファイル: plugin.cpp プロジェクト: FarManagerLegacy/farplug
UnicodeString DeviceInfo::strid() {
  const unsigned size = 64;
  UnicodeString res;
  VERIFY(StringFromGUID2(id, res.buf(size), size) != 0);
  res.set_size();
  return res;
}
コード例 #2
0
UnicodeString reg_read_string(HKEY hkey, const UnicodeString& name, const UnicodeString& def_value) {
  UnicodeString value = def_value;
  DWORD type = REG_SZ;
  DWORD data_size;
  // get string size
  LONG res = RegQueryValueExW(hkey, name.data(), NULL, &type, NULL, &data_size);
  if (res == ERROR_SUCCESS) {
    UnicodeString data;
    // get string value
    res = RegQueryValueExW(hkey, name.data(), NULL, &type, (LPBYTE) data.buf(data_size / sizeof(wchar_t)), &data_size);
    if (res == ERROR_SUCCESS) {
      data.set_size(data_size / sizeof(wchar_t) - 1); // throw away terminating NULL
      value = data;
    }
  }
  return value;
}
コード例 #3
0
ファイル: util.cpp プロジェクト: FarManagerLegacy/farplug
void ansi_to_unicode(UnicodeString& u_str, const AnsiString& a_str) {
  unsigned size = a_str.size() + 1;
  int res = MultiByteToWideChar(CP_ACP, 0, a_str.data(), size, u_str.buf(a_str.size()), size);
  if (res == 0) FAIL(SystemError());
  u_str.set_size(res - 1);
}