| 239 | } |
| 240 | |
| 241 | bool CommandTasks::LoadCmdTask(SettingsBase* reg, int iIndex) |
| 242 | { |
| 243 | bool lbRc = false; |
| 244 | wchar_t szVal[32]; |
| 245 | int iCmdMax = 0, iCmdCount = 0; |
| 246 | DWORD VkMod = 0; |
| 247 | |
| 248 | wchar_t* pszNameSet = nullptr; |
| 249 | if (iIndex >= 0) |
| 250 | { |
| 251 | if (!reg->Load(L"Name", &pszNameSet) || !*pszNameSet) |
| 252 | { |
| 253 | SafeFree(pszNameSet); |
| 254 | goto wrap; |
| 255 | } |
| 256 | } |
| 257 | else |
| 258 | { |
| 259 | //_ASSERTE(&pTask == &StartupTask); |
| 260 | _ASSERTE(iIndex == -1 && "This must be StartupTask"); |
| 261 | } |
| 262 | |
| 263 | //pTask = (CommandTasks*)calloc(1, sizeof(CommandTasks)); |
| 264 | //if (!pTask) |
| 265 | //{ |
| 266 | // SafeFree(pszNameSet); |
| 267 | // goto wrap; |
| 268 | //} |
| 269 | |
| 270 | if (pszName || pszGuiArgs || pszCommands) |
| 271 | { |
| 272 | _ASSERTE(pszName == nullptr && pszGuiArgs == nullptr && pszCommands == nullptr); |
| 273 | SafeFree(pszName); |
| 274 | SafeFree(pszGuiArgs); |
| 275 | SafeFree(pszCommands) |
| 276 | } |
| 277 | |
| 278 | this->SetName(pszNameSet, iIndex); |
| 279 | |
| 280 | this->HotKey.HkType = chk_Task; |
| 281 | if ((iIndex >= 0) && reg->Load(L"Hotkey", VkMod)) |
| 282 | this->HotKey.SetVkMod(VkMod); |
| 283 | else |
| 284 | this->HotKey.Key.Set(); |
| 285 | |
| 286 | if (iIndex >= 0) |
| 287 | { |
| 288 | reg->Load(L"Flags", this->Flags); |
| 289 | } |
| 290 | |
| 291 | if (!reg->Load(L"GuiArgs", &this->pszGuiArgs) || !*this->pszGuiArgs) |
| 292 | { |
| 293 | this->cchGuiArgMax = 0; |
| 294 | SafeFree(this->pszGuiArgs); |
| 295 | } |
| 296 | else |
| 297 | { |
| 298 | this->cchGuiArgMax = _tcslen(this->pszGuiArgs)+1; |
no test coverage detected