IVdsPack::CreateVolume - c++

HRESULT CreatePartitionEx(ULONGLONG ullOffset, ULONGLONG ullSize, ULONG ulAlign, [in] CREATE_PARTITION_PARAMETERS *para, IVdsAsync **ppAsync
)
When i am passing parameter ppAsync = NULL , perticular call is failing and returned INVALIED argument.
Please help me to solve this issue.

According to the documentation, concerning the last parameter - ppAsync:
The address of an IVdsAsync interface pointer, which VDS initializes
on return. Callers must release the interface. Use this pointer to
cancel, wait for, or query the status of the operation.
This means that you should provide an actual pointer as a last parameter when calling the function. Since you are providing NULL, probably that is causing the problem.
EDIT:
Use like this:
IVdsAsync *pAsync; // Declare a pointer
// Then use it like this (take a look at the last parameter)
CreatePartitionEx(
ullOffset,
ullSize,
ulAlign,
para,
&pAsync); // You pass it with a leading &, which gives you the address of the pointer
And that should do it.
Remember that you should release the pAsync after you are finished with it, as the documentation states.

I am doing the same thing with Createvolume() , buts its returning hResult= E_InvalidArg . The fourth parameter is stripe size .The Windows implementation requires the stripe size to be 65536 if the type is VDS_VT_STRIPE or VDS_VT_PaARITY. Other volume types are not striped and the stripe size is 0.

Related

How to use `ID311VideoContext::GetDecoderBuffer()`

I have a raw h264 stream, and would like to decode it using directx11.
I'm following these docs, and am the section to actually start decoding frames. (ie Calling BeginDecodeFrame())
I'm also following some advice from this question:
Which references an older verson of the same docs I linked previously. Anyway, it's saying that I need to fill some buffers:
D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS
D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX
D3D11_VIDEO_DECODER_BUFFER_BITSTREAM
D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL
I'm relatively familiar with h264, and understand I can get this information from parsing the NALU's. That being said, I don't want to manually parse the h264 packets themselves, It seems like there should be some kind of convenience method to do this for me.. So is there??
Coming from the Mac world, I can just call: CMVideoFormatDescriptionCreateFromH264ParameterSets with the PPS and SPS data and that'll handle it for me.
A follow up on that, how exactly do I "Fill These Buffers" ?
HRESULT GetDecoderBuffer(
[in] ID3D11VideoDecoder *pDecoder,
[in] D3D11_VIDEO_DECODER_BUFFER_TYPE Type,
[out] UINT *pBufferSize,
[out] void **ppBuffer
);
The function signature expects an out param of (void**), so if I wanted to fill D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS, how do exactly to do I fill it with the parsed data? Do I need to assign a pointer to DXVA_PictureParameters and then cast it as a void** like: (void**)&myPictureParamets when I call the function?
The linked docs state:
Direct3D 11 uses the same data structures as DXVA 2.0 for decoding operations.
So I'm kind of guessing on DXVA_PictureParameters being the correct struct to use here.
I was expecting this to be easier than it has been! :P

Function NetShareGetInfo return always 2310 (This share doesn't exist)

I want to recover the properties of a shared folder. I use the NetShareGetInfo function but it returns a 2310 error to me. This folder does not exist.
Here is my code:
NET_API_STATUS pStatus;
SHARE_INFO_2 pBuffer;
//here status return 2310 - This shared resource does not exist.
pStatus=NetShareGetInfo(nullptr, L"\\\\PCRT-S35521\\sharedFolder", 2, reinterpret_cast<LPBYTE*>(&pBuffer));
Does anyone know where this problem could come from? Because the network path is correct and the rights are correct
The documentation says that if the first argument, the server name, is NULL then the local computer is used. That is why your code is returning NERR_NetNameNotFound.
As well as that, you are passing the final parameter incorrectly. You need an extra level of indirection because the function allocates the buffer.
It should look something like this:
NET_API_STATUS pStatus;
SHARE_INFO_2 *pBuffer;
pStatus = NetShareGetInfo(L"PCRT-S35521", L"sharedFolder", 2, (LPBYTE)&pBuffer);
Remember to follow the instruction given in the documentation to destroy the buffer:
This buffer is allocated by the system and must be freed using the NetApiBufferFree function.

Getting the date that a registry key was created/modified in C++

I can't seem to find a way of doing this, but it seems strange to me that a registry key wouldn't be given a time stamp at all when created. Does anyone know of a way? Target platform is XP 32 bit.
Thanks.
RegQueryInfoKey() states that it can retrieve the last modified time:
lpftLastWriteTime [out, optional]
A pointer to a FILETIME structure that receives the last write time.
This parameter can be NULL.
The function sets the members of the FILETIME structure to indicate
the last time that the key or any of its value entries is modified.

ExpandEnvironmentStrings Not Expanding My Variables

I have a process under the Run key in the registry. It is trying to access an environment variable that I have defined in a previous session. I'm using ExpandEnvironmentStrings to expand the variable within a path. The environment variable is a user profile variable. When I run my process on the command line it does not expand as well. If I call 'set' I can see the variable.
Some code...
CString strPath = "\\\\server\\%share%"
TCHAR cOutputPath[32000];
DWORD result = ExpandEnvironmentStrings((LPSTR)&strPath, (LPSTR)&cOutputPath, _tcslen(strPath) + 1);
if ( !result )
{
int lastError = GetLastError();
pLog->Log(_T( "Failed to expand environment strings. GetLastError=%d"),1, lastError);
}
When debugging Output path is exactly the same as Path. No error code is returned.
What is goin on?
One problem is that you are providing the wrong parameters to ExpandEnvironmentStrings and then using a cast to hide that fact (although you do need a cast to get the correct type out of a CString).
You are also using the wrong value for the last parameter. That should be the size of the output buffer, not the size of the input length (from the documentation the maximum number of characters that can be stored in the buffer pointed to by the lpDst parameter)
Putting that altogether, you want:
ExpandEnvironmentStrings((LPCTSTR)strPath,
cOutputPath,
sizeof(cOuputPath) / sizeof(*cOutputPath));
I don't see any error checking code in your snippet, you don't assert the return value. If there's a problem, you'd never discover it. Also, you are using ANSI strings, beware of the weirdo requirement for the nSize argument (1 extra).
What about buffersize ? Is it initialized - to the right value ?
The documentation states that If the destination buffer is too small to hold the expanded string, the return value is the required buffer size, in characters.

Getting GPU clock speeds with SetupDiEnumDeviceInfo

I posted a question earlier regarding obtaining GPU clock speeds, but I guess the thread appeared as already answered since someone had replied to it.
I'd been advised by one of your members to try extracting GPU clock speeds using SetupDiEnumDeviceInfo.
However, I looked around at some examples, like this one: http://www.codeproject.com/KB/system/DevMgr.aspx
and nothing seemed to be displayed about the clock speed.
Could someone please elaborate on how to achieve this, if at all possible?
Thanks again
You will want to check out this msdn article:
http://msdn.microsoft.com/en-us/library/bb742655.aspx
Specifically, follow these steps:
Call SetupDiGetDeviceRegistryProperty to retrieve the size, in bytes, of the property value. Supply the following parameter values:
Set DeviceInfoSet to a handle to a device information set that contains the device instance for which to retrieve the requested property value.
Set DeviceInfoData to a pointer to an SP_DEVINFO_DATA structure that represents the device instance for which to retrieve the requested property value.
Set Property to an SPDRP_Xxx identifier. For a list of these identifiers and a description of the corresponding device properties, see the description of the Property parameter that is included with SetupDiSetDeviceRegistryProperty.
Set PropertyRegDataType to a pointer to a DWORD-typed variable.
Set PropertyBuffer to NULL.
Set PropertyBufferSize to zero.
Set RequiredSize to a pointer to a DWORD-typed variable that receives, the size, in bytes of the property value.
In response to the call to SetupDiSetDeviceRegistryProperty, SetupDiGetDeviceRegistryProperty sets *RequiredSize to the size, in bytes, of the buffer that is required to retrieve the property value, logs the error code ERROR_INSUFFICIENT_BUFFER, and returns FALSE. A subsequent call to GetLastError will return the most recently logged error code.
Call SetupDiGetDeviceRegistryProperty again and supply the same parameter values that were supplied in the first call, except for the following changes:
Set PropertyBuffer to a pointer to a BYTE-typed buffer that receives the requested property value.
Set PropertyBufferSize to the the size, in bytes, of the PropertyBuffer buffer. The first call to SetupDiGetDeviceRegistryProperty retrieved the required size of the PropertyBuffer buffer in *RequiredSize.
This link shows how to get to the point where you've got the required strucutres to call SetupDiGetDeviceRegistryProperty.
http://www.pinvoke.net/default.aspx/setupapi/SetupDiEnumDeviceInfo.html