| 1114 | |
| 1115 | |
| 1116 | int cmdUpdate(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) |
| 1117 | /*++ |
| 1118 | |
| 1119 | Routine Description: |
| 1120 | UPDATE |
| 1121 | update driver for existing device(s) |
| 1122 | |
| 1123 | Arguments: |
| 1124 | |
| 1125 | BaseName - name of executable |
| 1126 | Machine - machine name, must be NULL |
| 1127 | argc/argv - remaining parameters |
| 1128 | |
| 1129 | Return Value: |
| 1130 | |
| 1131 | EXIT_xxxx |
| 1132 | |
| 1133 | --*/ |
| 1134 | { |
| 1135 | HMODULE newdevMod = NULL; |
| 1136 | int failcode = EXIT_FAIL; |
| 1137 | UpdateDriverForPlugAndPlayDevicesProto UpdateFn; |
| 1138 | BOOL reboot = FALSE; |
| 1139 | LPCTSTR hwid = NULL; |
| 1140 | LPCTSTR inf = NULL; |
| 1141 | DWORD flags = 0; |
| 1142 | DWORD res; |
| 1143 | TCHAR InfPath[MAX_PATH]; |
| 1144 | |
| 1145 | UNREFERENCED_PARAMETER(BaseName); |
| 1146 | UNREFERENCED_PARAMETER(Flags); |
| 1147 | |
| 1148 | if(Machine) { |
| 1149 | // |
| 1150 | // must be local machine |
| 1151 | // |
| 1152 | return EXIT_USAGE; |
| 1153 | } |
| 1154 | if(argc<2) { |
| 1155 | // |
| 1156 | // at least HWID required |
| 1157 | // |
| 1158 | return EXIT_USAGE; |
| 1159 | } |
| 1160 | inf = argv[0]; |
| 1161 | if(!inf[0]) { |
| 1162 | return EXIT_USAGE; |
| 1163 | } |
| 1164 | |
| 1165 | hwid = argv[1]; |
| 1166 | if(!hwid[0]) { |
| 1167 | return EXIT_USAGE; |
| 1168 | } |
| 1169 | // |
| 1170 | // Inf must be a full pathname |
| 1171 | // |
| 1172 | res = GetFullPathName(inf,MAX_PATH,InfPath,NULL); |
| 1173 | if((res >= MAX_PATH) || (res == 0)) { |
no test coverage detected