You seem to be confused about the correct use of pointers in your code. You define lpsh as:
SHFILEOPSTRUCTA lpsh{};
But that is not an array, it is a structure, so you need to pass its address to the
SHFileOperationA
function. You should rename it (and pfs) so it makes more sense:
SHFILEOPSTRUCTA shFileOPStruct{};
ZeroMemory(&shFileOPStruct, sizeof(SHFILEOPSTRUCT));
shFileOPStruct.hwnd = hWnd;
shFileOPStruct.wFunc = FO_COPY;
shFileOPStruct.pFrom = (LPCSTR)"C:\\Users\\*.*\0";
shFileOPStruct.pTo = (LPCSTR)"C:\\UData\0";
shFileOPStruct.fFlags = FOF_ALLOWUNDO | FOF_NOCOPYSECURITYATTRIBS;
shFileOPStruct.fAnyOperationsAborted = 0; HANDLE fsHandle = 0; shFileOPStruct.hNameMappings = &fsHandle; SHFileOperationA(&shFileOPStruct);