tstSSM-2.cpp revision 0888c638f6ea789c5bd594c5e81ef3b75e2fcf0b
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * Saved State Manager Testcase: Extract the content of a saved state.
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * Copyright (C) 2015 Oracle Corporation
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * available from http://www.virtualbox.org. This file is free software;
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * you can redistribute it and/or modify it under the terms of the GNU
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * General Public License (GPL) as published by the Free Software
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync/*******************************************************************************
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync* Header Files *
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync*******************************************************************************/
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsyncstatic RTEXITCODE extractUnit(const char *pszFilename, const char *pszUnitname, const char *pszOutputFilename)
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync rc = RTFileOpen(&hFile, pszOutputFilename, RTFILE_O_DENY_NONE | RTFILE_O_WRITE | RTFILE_O_CREATE);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync rc = SSMR3Seek(pSSM, pszUnitname, 0 /* iInstance */, &version);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync rc = RTFileWrite(hFile, &u8, sizeof(u8), &cbWritten);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync RTPrintf("Unit size %zu bytes, version %d\n", cbUnit, version);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync RTPrintf("Cannot find unit '%s' (%Rrc)\n", pszUnitname, rc);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync RTPrintf("Cannot open output file '%s' (%Rrc)\n", pszOutputFilename, rc);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync RTPrintf("Cannot open SSM file '%s' (%Rrc)\n", pszFilename, rc);
40de92f85ffb44d3078fea55380a471a7e84ca01vboxsync RTPrintf("Usage: %s <SSM filename> <SSM unitname> <outfile>\n", RTPathFilename(argv[0]));
0888c638f6ea789c5bd594c5e81ef3b75e2fcf0bvboxsync /* don't fail by default */