tstGlobalConfig.cpp revision 86b51be433c7032578ae50e94ebe590cc428448b
46f059bea92bedbd395793702c73946ead235586vboxsync * Ring-3 Management program for the GCFGM mock-up.
46f059bea92bedbd395793702c73946ead235586vboxsync * Copyright (C) 2007 innotek GmbH
46f059bea92bedbd395793702c73946ead235586vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
46f059bea92bedbd395793702c73946ead235586vboxsync * available from http://www.virtualbox.org. This file is free software;
46f059bea92bedbd395793702c73946ead235586vboxsync * you can redistribute it and/or modify it under the terms of the GNU
46f059bea92bedbd395793702c73946ead235586vboxsync * General Public License as published by the Free Software Foundation,
46f059bea92bedbd395793702c73946ead235586vboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
46f059bea92bedbd395793702c73946ead235586vboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync/*******************************************************************************
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync* Header Files *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync*******************************************************************************/
46f059bea92bedbd395793702c73946ead235586vboxsync * Prints the usage and returns 1.
46f059bea92bedbd395793702c73946ead235586vboxsync * @return 1
46f059bea92bedbd395793702c73946ead235586vboxsyncstatic int Usage(void)
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("usage: tstGlobalConfig <value-name> [new value]\n");
46f059bea92bedbd395793702c73946ead235586vboxsync * Parse args, building the request as we do so.
46f059bea92bedbd395793702c73946ead235586vboxsync /* arg[1] = szName */
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("syntax error: malformed name '%s'\n", argv[1]);
1bef0d3fd3b2fe689a4eaa9ebf0647b8bf7c662evboxsync RTPrintf("syntax error: the name is too long. (max %zu chars)\n", argv[1], sizeof(Req.szName) - 1);
46f059bea92bedbd395793702c73946ead235586vboxsync /* argv[2] = u64SetValue; optional */
46f059bea92bedbd395793702c73946ead235586vboxsync int rc = RTStrToUInt64Ex(argv[2], &pszNext, 0, &Req.u64Value);
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("syntax error: '%s' didn't convert successfully to a number. (%Rrc,'%s')\n", argv[2], rc, pszNext);
46f059bea92bedbd395793702c73946ead235586vboxsync * Open the session, load ring-0 and issue the request.
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("tstGlobalConfig: SUPInit -> %Rrc\n", rc);
df2e37f58f19997178bb9be53867a17509a3a2f9vboxsync rc = SUPCallVMMR0Ex(NIL_RTR0PTR, enmOp, 0, &Req.Hdr);
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("%s = %RU64 (%#RX64)\n", Req.szName, Req.u64Value, Req.u64Value);
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("Successfully set %s = %RU64 (%#RX64)\n", Req.szName, Req.u64Value, Req.u64Value);
46f059bea92bedbd395793702c73946ead235586vboxsync RTPrintf("error: Failed to query '%s', rc=%Rrc\n", Req.szName, rc);