Timeout expires during database restore
You have no problem with permissions (otherwise you'd got "access denied" or "file not found" errors), nither it's a lock timeout. This timeout is set up in your C++ program, if I'm not mistaken, 30 seconds is the default. SQL Server has no timeouts at all, you should change the property in your application, smth like SqlCommand.CommandTimeout